1.

Solve : How do I copy text in a text file to another file using batch file??

Answer»

Hi All,

I am using windows XP pro and I need to be able to take a RAW text file and using a batch file and pipe out certain information into another text file.

Example:

Raw text file may contain name, address, phone etc… and I want to take all the text lines that have the name “Smith” in them and COPY them to another text file called ‘Names.txt’

Is there a way to pipe the entire line into another file?

THANKS for your help
Ken


You can use the Type command and pipe its output through Find.exe.

Suppose Rawfile.txt contained these lines

John Smith
Bill Brown
Sam Jones
Smith Z Wilson
George W Shrub
Amy Q Smith

then this command would create a file called Names.txt

type "Rawfile.txt" | find "Smith" > "Names.txt"

Names.txt would look like this

John Smith
Smith Z Wilson
Amy Q Smith
Thank you very much... That does what I want. Have a Great Day!

Ken



Discussion

No Comment Found