![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Perl: Search for string on line then search and replace text | Crypto | Shell Programming and Scripting | 4 | 01-04-2008 06:24 AM |
| Too simple to search for | spudtheimpaler | UNIX for Dummies Questions & Answers | 3 | 10-21-2006 09:55 AM |
| Search/Replace with Sed | mvalonso | UNIX for Dummies Questions & Answers | 5 | 05-08-2006 04:30 PM |
| Help : Search and Replace | ctcuser | Shell Programming and Scripting | 2 | 12-02-2004 10:15 AM |
| Simple? Search replace | Brandt | UNIX for Dummies Questions & Answers | 9 | 01-16-2004 09:51 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
Simple Search and Replace - Revisited
I have a ascii file with lines like this:
240|^M\ ^M\^M\ Old Port Marketing order recd $62,664.- to ship 6/22/99^M\ when this record gets loaded into my database, the \ is stored literally and so the user sees carriage return \ (hex 0D 5C) when what i need is carriage return line feed (hex 0D 0A). any ideas on how i can accomplish this with sed? P. S. awhile back, Perderabo wrote this sed script for me #! /usr/bin/sed -nf # # s/^M\\$/^M\\/ H t x s/\n//g p s/.*// h which altered a files like this: 240|^M\ ^M\ ^M\ Old Port Marketing order recd $62,664.- to ship 6/22/99^M\ to look like this: 240|^M\ ^M\^M\ Old Port Marketing order recd $62,664.- to ship 6/22/99^M\ |
| Forum Sponsor | ||
|
|