Computing.Net > Forums > Programming > Moving columns in a txt file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Moving columns in a txt file

Reply to Message Icon

Name: jmalijan
Date: August 26, 2009 at 07:03:48 Pacific
OS: Windows XP
CPU/Ram: 2 gig
Product: Microsoft Windows xp inside out
Subcategory: Batch
Comment:

Hi,

Ive read you post in this forum and you were great.
I just want to ask your help, I have a batch file that contains several records. I have an entry for example 'ABC' in column 247, I need a batch file that will scan my txt file (per record) and move each strings in column 247 to 242 .
Please help.
Thank you very much.

Jesfer




Sponsored Link
Ads by Google

Response Number 1
Name: Wahine
Date: August 27, 2009 at 01:04:36 Pacific
Reply:

Is there a header, how are the columns defined?


0

Response Number 2
Name: jmalijan
Date: August 27, 2009 at 07:39:27 Pacific
Reply:

Hi,

There is no header. Lets say, column 247 contains 5characters, it needs to be moved to column 242 (which is empty).

I just need to move column 247 to 242. Pls help.

Thanks,
JM


0

Response Number 3
Name: Razor2.3
Date: August 27, 2009 at 07:56:33 Pacific
Reply:

What denotes a column?


0

Response Number 4
Name: jmalijan
Date: August 27, 2009 at 08:06:33 Pacific
Reply:

A column doensnt have a header and is generated from a different program. That column is mis positionned and should be moved to column 242, which is empty. It is displayed in column 247. It contains a maximum of 5 characters. If possible to move, should have no problem with column 242 because it is empty.

Pls advice.

Thanks,
JM


0

Response Number 5
Name: Razor2.3
Date: August 27, 2009 at 09:37:16 Pacific
Reply:

You have yet to specify what separates these columns.


0

Related Posts

See More



Response Number 6
Name: jmalijan
Date: August 27, 2009 at 09:55:59 Pacific
Reply:

Im just thingking, but i dont know hot to implement it in a batch file,
would it be possible to just go to the column number?

Example, ill go to column 242, delete the next 5 spaces, so column 247 will be moved to column 242?

If possible, please help me implement this logic using batch file.

Thank you.


0

Response Number 7
Name: jmalijan
Date: August 27, 2009 at 09:59:09 Pacific
Reply:

example of the file is: (actual character varies on the actual file)

Test ABC 123


Can i move directly 123 two spaces after ABC?
I have few rows in my text file that needs to do the same.

Pls advice.

Thank you


0

Response Number 8
Name: Razor2.3
Date: August 27, 2009 at 10:12:22 Pacific
Reply:

Assuming "column" means "character position" (untested):

SETLOCAL ENABLEDELAYEDEXPANSION
FOR /F "usebackq delims=" %%a IN ("input.txt") DO @(SET a=%%a
echo !a:~0,242!!a:~246!) >output.txt


0

Sponsored Link
Ads by Google
Reply to Message Icon

python - can anyone help ... Batch to edit contents of...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Moving columns in a txt file

Batch File: Integers in a Txt File Variable www.computing.net/answers/programming/batch-file-integers-in-a-txt-file-variable/19900.html

How to delete first for lines in a txt file www.computing.net/answers/programming/how-to-delete-first-for-lines-in-a-txt-file/20172.html

Batch to add the column in a txt file www.computing.net/answers/programming/batch-to-add-the-column-in-a-txt-file/19625.html