![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| To remove new line character | shihabvk | UNIX for Advanced & Expert Users | 7 | 06-18-2009 07:44 AM |
| Remove last character of a term | Raynon | Shell Programming and Scripting | 6 | 03-20-2008 06:04 AM |
| How to remove extraneous character | vsmurali | UNIX for Dummies Questions & Answers | 7 | 03-18-2008 12:57 PM |
| Trying to remove single character from a line | Iz3k34l | UNIX for Dummies Questions & Answers | 5 | 07-07-2007 01:29 PM |
| Remove Last Character of Line | danhodges99 | Shell Programming and Scripting | 4 | 05-21-2003 09:30 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Script to Remove Garbage Character
Hello,
Whenever I transfer files between machines, I find a garbage character (^M) being appended to the end of every line of the file. Can you suggest a script wherein I can eliminate the garbage character. I tried sed 's/^M//g' < filename > filename1 ...but it doesn't work. Also, this being an escape character, does it add more complexity than it would take to eliminate a normal character? Thanks in anticipation. |
|
||||
|
If you just wan to delete all control chars without having to pipe to a new file and rename it, use:
This will get rid of all the control chars in the file. Code:
echo '%s/[[:cntrl:]]//g\nwq' | ex filename This will just delete the ^M's Code:
echo '%s/\015//g\nwq' | ex filename |
|
||||
|
thank you very much for your inputs.. it was of great help ...
![]() |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|