removing new line character using sed
How to remove new line character using sed?
cat $myfile Using my computer, you can prevent activities related to this info by using fun stuff of this utility with the signature. -------------------- I want to remove newline character and insert a single whitespace so that cat $myfile Using my computer, you can prevent activities related to this info by using fun stuff of this utility with the signature. ------------------------------------------------------------- sed 's/\n/ /g' myfile -----is not working How to do this using sed? pls help... |
Code:
sed '/^$/d' myfile Regards |
Quote:
Code:
perl -ne 'chomp; print "$_ ";' myfile Code:
perl -ne 'chomp; s/(^\s+|\s+$)//g; print "$_ " if ( $_ ne "" );' doc |
Thanks matthewg42,
It solved my problem.... :) |
More Perl
Quote:
In Perl you can do: perl -pi.bk -e 's/^\s+$//' myfile For brave souls you can skip the .bk part, but don't say I didn't warn you ;-) |
All times are GMT -5. The time now is 02:35 AM. |