0

C:\Incoming\records.txt

11 record(s) received

5021462426325

5021462426325

5021462426325

5021462426325

5021462426325

8901090213511

8901090213511

8901090213511

8901090213511

0080432400708

0080432400708

The desired format of the file contents

5021462426325,5021462426325,5021462426325,5021462426325,5021462426325,8901090213511,8901090213511,8901090213511,8901090213511,0080432400708,0080432400708

Then copy this from C:\Incoming to C:\Outgoing and place the old file in C:\Stored.

2
  • I'd learn Powershell or install Windows ports of some standard UNIX/Linux tools for scripting. Commented Sep 14, 2012 at 13:17
  • That is precisely the constraint, else I could have easily done that. Commented Sep 14, 2012 at 13:18

1 Answer 1

1
for /f "tokens=* skip=1" %%i in (C:\Incoming\records.txt) do echo|set /p="%%i,">>C:\Outgoing\records.txt
move C:\Incoming\records.txt C:\Stored\records.txt
Sign up to request clarification or add additional context in comments.

4 Comments

There is a preceding comma and Can I just do a wildcard with the file name? --- The output is ,5021462426325,5021462426325,5021462426325,5021462426325,5021462426325,8901090213511,8901090213511,8901090213511,8901090213511,
No, you can't use a wildcard. I just copied your text and there is no proceeding comma, have you edited the command? There is a comma at the end actually, but not at the start.
Okie, I think I understand what the issue might be. There is a newline between the first record and the line "11 record(s) received". How do i handle that?
@shoonya - Change skip=1 to skip=2.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.