Link to home
Start Free TrialLog in
Avatar of AlexKhaw
AlexKhaw

asked on

look for DOS Script that help to extract data from text file

Hi There,
i am looking for Dos script that can help to extract data (from EOF until a space line marking) from a text file and put the needed data in another new file. I am not good in scripting hope can get a code to reference.

Thank you.
Avatar of roadhog_NZ
roadhog_NZ

you could look at the windows help for "FOR"

otherwise can you be more specific? reading from EOF to a line break would mean you are reading back from the end of the file... is that what you wish to do?
Avatar of AlexKhaw

ASKER

Yes. i would like to read from end of file and backward, until i reach a line break.
Hi,
You need the unix 'tail' utility which you can get from This URL http://users.rcn.com/rprew/dos.htm which provides a download of several of the essential Unix Utilities, ported to Windows.
see http://www.cs.huji.ac.il/~bioskill/MAN/tail.html
for the unix man page.
in your DOS batch file,
tail -n 1 filename
will display the last line of the file, and
tail -n 1 filename > outputfile
will pipe the last line into a file of it's own.

Please note: I have not checked the version of tail at the URL I have included. My original link for the version I currently use is now broken. However, if it is a true port of Unix tail, the above should hold true.

Regards .. Alan


ASKER CERTIFIED SOLUTION
Avatar of roadhog_NZ
roadhog_NZ

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial