Re: remove '\' with new-line
david [EMAIL PROTECTED] wrote: Jeff Westman wrote: I need a one-liner to convert all occurances read from a Unix pipe of 'backslash' + 'literal new line (hex 0a)' to become just 'literal new line (hex 0a)' That is, remove the '\' only when it preceeds a new-line. Again, this must be read from a pipe. This is what I have so far, but it doesnt do work: cat dfile | perl -pe 'BEGIN { $str = ord(10); } s!\\$str!$str!g' Suggestions?! that's because: [panda]# perl -le 'print ord(10)' 49 [panda]# perl -e 'print chr(10)' [panda]# you want chr(10): [panda]# cat dfile \abcd\xxx\yyy\ 1234\zzz [panda]# perl -pe 's.\\\n.\n.g' dfile \abcd\xxx\yyy 1234\zzz [panda]# perl -pe 'BEGIN{$n = chr(10)} s.\\$n.$n.g' \abcd\xxx\yyy 1234\zzz That did the trick. Thanks for catching my error. Jeff david -- s$s*$+/tgmecJntgRtgjvqpCvuwL$;$;=qq$ \x24\x5f\x3d\x72\x65\x76\x65\x72\x73\x65 \x24\x5f\x3b\x73\x2f\x2e\x2f\x63\x68\x72 \x28\x6f\x72\x64\x28\x24\x26\x29\x2d\x32 \x29\x2f\x67\x65\x3b\x70\x72\x69\x6e\x74 \x22\x24\x5f\x5c\x6e\x22\x3b\x3b$;eval$; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response __ Do you Yahoo!? Yahoo! Search - Find what youre looking for faster http://search.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
remove '\' with new-line
I need a one-liner to convert all occurances read from a Unix pipe of 'backslash' + 'literal new line (hex 0a)' to become just 'literal new line (hex 0a)' That is, remove the '\' only when it preceeds a new-line. Again, this must be read from a pipe. This is what I have so far, but it doesnt do work: cat dfile | perl -pe 'BEGIN { $str = ord(10); } s!\\$str!$str!g' Suggestions?! __ Do you Yahoo!? Yahoo! Search - Find what youre looking for faster http://search.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: remove '\' with new-line
Jeff Westman wrote: I need a one-liner to convert all occurances read from a Unix pipe of 'backslash' + 'literal new line (hex 0a)' to become just 'literal new line (hex 0a)' That is, remove the '\' only when it preceeds a new-line. Again, this must be read from a pipe. This is what I have so far, but it doesnt do work: cat dfile | perl -pe 'BEGIN { $str = ord(10); } s!\\$str!$str!g' Suggestions?! that's because: [panda]# perl -le 'print ord(10)' 49 [panda]# perl -e 'print chr(10)' [panda]# you want chr(10): [panda]# cat dfile \abcd\xxx\yyy\ 1234\zzz [panda]# perl -pe 's.\\\n.\n.g' dfile \abcd\xxx\yyy 1234\zzz [panda]# perl -pe 'BEGIN{$n = chr(10)} s.\\$n.$n.g' \abcd\xxx\yyy 1234\zzz david -- s$s*$+/tgmecJntgRtgjvqpCvuwL$;$;=qq$ \x24\x5f\x3d\x72\x65\x76\x65\x72\x73\x65 \x24\x5f\x3b\x73\x2f\x2e\x2f\x63\x68\x72 \x28\x6f\x72\x64\x28\x24\x26\x29\x2d\x32 \x29\x2f\x67\x65\x3b\x70\x72\x69\x6e\x74 \x22\x24\x5f\x5c\x6e\x22\x3b\x3b$;eval$; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: remove '\' with new-line
Jeff Westman wrote: I need a one-liner to convert all occurances read from a Unix pipe of 'backslash' + 'literal new line (hex 0a)' to become just 'literal new line (hex 0a)' That is, remove the '\' only when it preceeds a new-line. Again, this must be read from a pipe. This is what I have so far, but it doesnt do work: cat dfile | perl -pe 'BEGIN { $str = ord(10); } s!\\$str!$str!g' Suggestions?! cat dfile | perl -pe's/\\$//' Or just: perl -pe's/\\$//' dfile John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response