English 中文(简体)
将 txt 文件拆分为两个文件以插入 DB
原标题:Split a txt file into two files to insert in a DB
  • 时间:2012-05-24 11:02:16
  •  标签:
  • database

i 从 db 导出的. txt 文件有问题 。

文件包含经度和纬度坐标,其中每个条目的结构如下:

5d11 25.753"W   39d1 29.733"N 0.000

我需要将这个文件分割为两个单独的文件, 一个包含经度, 另一个包含纬度。 我不需要记录中的 0.0000 。

任何关于我如何做到这一点的想法, 文件是相当长的, 我不能手动做它。

最佳回答

对于给定的输入文件输入. txt, 这将创建两个输出( 长. txt 和 lat. txt), 并包含相应的列。 注意, 如果您再次运行, 您需要删除长. txt 和 lat. txt, 或者这些列将直接附加到现有文件 。

for /f "tokens=1,2,3 delims= " %%i in (input.txt) do (
    echo %%i >> long.txt
    echo %%j >> lat.txt
)

<这一答案为基础。

只要将代码复制为批量文件( exprest.bat) 并运行...

问题回答

暂无回答




相关问题
what is wrong with this mysql code

$db_user="root"; $db_host="localhost"; $db_password="root"; $db_name = "fayer"; $conn = mysqli_connect($db_host,$db_user,$db_password,$db_name) or die ("couldn t connect to server"); // perform query ...

Users asking for denormalized database

I am in the early stages of developing a database-driven system and the largest part of the system revolves around an inheritance type of relationship. There is a parent entity with about 10 columns ...

Easiest way to deal with sample data in Java web apps?

I m writing a Java web app in my free time to learn more about development. I m using the Stripes framework and eventually intend to use hibernate and MySQL For the moment, whilst creating the pages ...

join across databases with nhibernate

I am trying to join two tables that reside in two different databases. Every time, I try to join I get the following error: An association from the table xxx refers to an unmapped class. If the ...

How can I know if such value exists in database? (ADO.NET)

For example, I have a table, and there is a column named Tags . I want to know if value programming exists in this column. How can I do this in ADO.NET? I did this: OleDbCommand cmd = new ...

Convert date to string upon saving a doctrine record

I m trying to migrate one of my PHP projects to Doctrine. I ve never used it before so there are a few things I don t understand. In my current code, I have a class similar to this: class ...

热门标签