![]() |
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 |
| Need to replace the first word of a line if it occurs again in the next line(shell) | geeko | Shell Programming and Scripting | 4 | 06-18-2009 02:36 PM |
| replace only 1st word of a line if it comes in the subsequent lines at same postion. | geeko | Shell Programming and Scripting | 9 | 06-03-2009 07:25 AM |
| Read line by line not word by word | vadharah | Shell Programming and Scripting | 6 | 03-02-2008 02:29 PM |
| how to move word by word on command line | pbsrinivas | UNIX for Dummies Questions & Answers | 1 | 11-23-2007 06:17 AM |
| Can a shell script pull the first word (or nth word) off each line of a text file? | tricky | Shell Programming and Scripting | 5 | 08-17-2006 06:29 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Could someone tell me how to replace a word at a particular line by a single SED or AWK command?
e.g. I have a file with the contents below: Code:
$ cat file1 111 AAA 333 CCC 222 BBB 444 CCC I want to replace the word "CCC" with a blank to get the desired output below: Code:
111 AAA 333 CCC 222 BBB 444 I can get the above by the command below but I want it to work for any line using simpler commands. Code:
paste -s file1 | sed -e s/CCC$// | tr -s '\11' '\12' Any help will be appreciated. Steve |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|