avh November 3, 2010 at 10:25:14 Specs: Windows XP
I have only written a few batch files and I have only done very simple things to automate my work. I have a big analysis to do and I really need help automating it or it will be impossible. I have 100 text files that are output from a program. I would like to go through the 100 files and extract a single line of text from each to copy into a new file that would contain all 100 lines in the same file. The line begins with a unique string followed by 16 numbers. There are spaces between the string and the numbers. As an example, uniquestring 1.0 128 32 32 22 22 27 0 5.5 7.6 10.8 1.0 2.0 1.0 4.0 13.0 I would really appreciate any help.
At prompt type mybat Folder_Name where Folder_Name is the folder holding your 100 text files.
:: MYBAT.BAT Usage mybat Folder_Name
if exist FileNew.txt del FileNew.txt
for %%j in (*.txt) do type "%%j" | find "uniquestring" >> FileNew.new
ren FileNew.new *.txt
M2 and Ivo, thank you very much. Both batch files work perfectly and having an example of two ways to solve the problem really helps me to figure out looping. Can either of you recommend any reading material for Windows command? I know unix and linux, but windows command books are really hard to find.
The information on Computing.Net is the opinions of its users. Such
opinions may not be accurate and they are to be used at your own risk.
Computing.Net cannot verify the validity of the statements made on this
site. Computing.Net and Purch hereby disclaim all responsibility
and liability for the content of Computing.Net and its accuracy.