I have a file where I want to remove ^M character from below
line1;^Mline2;
to have output as below:
line1; line2;
How can I achieve this without creating a temporary file? Would appreciate any shell command, perl command or eclipse find and replace.
I'm not sure if by ^M
you mean the literal string ^M
or the control-character (carriage-return). If you mean the literal string:
sed -e 's/\^M/\n/g' file
If you mean carriage-return:
sed -e 's/\r/\n/g' file
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.