![]() |
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 |
| How can I insert character to end of file? | umen | UNIX for Dummies Questions & Answers | 1 | 01-29-2008 07:47 AM |
| insert some text to a file log | bucci | Shell Programming and Scripting | 4 | 05-09-2007 07:19 AM |
| insert text into top of file | jimbob | Shell Programming and Scripting | 1 | 09-22-2006 05:46 PM |
| Insert text file at a certain line. | insania | Shell Programming and Scripting | 4 | 08-01-2006 02:46 AM |
| SED- Insert text at top of file | MBGPS | Shell Programming and Scripting | 12 | 07-03-2002 09:48 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Edit and insert character in a text file
Hello All,
Can somebody please help me how to accomplish the following : I have a text file called data.txt that has the following information : M|88494-998494 M|98jd#0094 M|88394-994049 M|GFG9980#009944 and so on... I need to replace the value of M to either "S" or "X" depending on whether there is "-" or "#" in the record. If there is a "-"m replace it with "S"..... Can I just use SED? thnaks! Joseph |
|
||||
|
sed
Quote:
sed -e '/\-/ s/M/S/' m.txt -ne '/\#/ s/M/X/' m.txt I have not tested it. Pls. check. Ram |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|