perl script inside batch script

March 29, 2009 at 00:56:58
Specs: Windows XP
how can i write the perl script inside the batch script.
to be more specific . i need to write a batch script which scans the tab delimited file by skipping first three lines and from rest of lines it must get only first row and write it into another file.
currently i am doing like this
For /f "eol= skip=3 tokens=1,2 delims=/ " %%a IN (%1) DO Echo %%a>>%output_path%
but this is not working so i thought of using perl code inside batch script but i don't sytax anybody please help me

See More: perl script inside batch script

Report •

March 29, 2009 at 01:20:11
if you want to use Perl,
perl -ne 'print if $.==4' file  > newfile.txt

Report •

March 29, 2009 at 05:51:33
thanks but , i need compleate which replaces batch command for "" , because it is taking hell lot of time to read and extract the file content

Report •

March 29, 2009 at 08:26:00
Unless I'm misinterpreting what you need, which is to extract only the 4th line in the file, the perl command that ghostdog gave will do what you want. Did you try it?

One change I'd make to it would be to add 'last' to it so that it doesn't run through the entire source file.

C:\>perl -ne "print and last if $. == 4" file > newfile.txt

Report •

Related Solutions

Ask Question