On Fri, 13 Feb 2004, Vishal Vasan wrote: > Hi All, > > I have a file with the following contents (temp.txt). > A1110 > G1115 > B1110 > C1111 > D1111 > E1113 > F1115 > and so on. I have to read the contents from this file and create 2 > seperate files. The 1st file contains the lines ending with 0 and 1 > while the 2nd file contains the lines ending with 3 and 5. I can do this > easily by creating a seperate perl script. But I have a constraint. I > should not write a seperate file to do this processing. > > I am calling the perl from a shell script. Is there any way of calling > the Perl program "in-line" with all the required parameters? "In-line" > means no seperate file containing the script. > > Is it worth doing this? Is there a better way of doing it? > > Regards, > Vishal Vasan.
This may be hearsy here on the Perl list, but is Perl the best choice in this case? If I had to imbed this in a shell script, I'd use grep twice. grep '[01]$' input.file >output.file.01 grep '[35]$' input.file >output.file.35 -- Maranatha! John McKown -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>