Click here to get back home

How can I send the output of the system() command to a file and capture a string in that file

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
How can I send the output of the system() command to a file and capture a string in that file prashant_ec2003 06-19-2005
Get Chitika Premium
Posted by Jürgen Exner on June 19, 2005, 9:12 pm
Please log in for more thread options
>>
>> [snip]
>>
>> > if I print "$1\n",
>> > the file prints just fine. But, if I do something like print "$1 after
>> > \n", the whole output is messed up. If I print "before $1\n", nothing
>> > prints at all. If I print "before $1 after\n", only after prints.
>>
>> not really sure, but could be a rogue "\r" in $1,


> There
> is a rogue carriage return (0xd) in the string

> Is there something I can do to deal with this
> situation?


Repair the corrupted file:

perl -p -i -e 'tr/\r//d' bad_file


--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas

Similar ThreadsPosted
Kindly help :::How can I send the output of the system() command to a file and capture a string in one of the lines in that file June 19, 2005, 1:40 pm
capture output from print command to variable in perl April 15, 2005, 4:32 pm
system command - redirect also the STDERR to a file October 16, 2006, 8:26 am
FAQ 8.24: Why can't I get the output of a command with system()? November 29, 2004, 12:03 pm
FAQ 8.24: Why can't I get the output of a command with system()? December 23, 2004, 6:03 pm
FAQ 8.24 Why can't I get the output of a command with system()? March 3, 2005, 6:03 am
FAQ 8.24 Why can't I get the output of a command with system()? May 21, 2005, 11:03 am
FAQ 8.24 Why can't I get the output of a command with system()? August 6, 2005, 10:03 am
FAQ 8.24 Why can't I get the output of a command with system()? September 28, 2005, 10:03 pm
FAQ 8.24 Why can't I get the output of a command with system()? June 26, 2006, 9:03 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap