![]() |
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 do i pattern match a field with awk? | someone123 | Shell Programming and Scripting | 4 | 06-03-2008 09:08 AM |
| To identify filename in which having match PATTERN | cedrichiu | Shell Programming and Scripting | 14 | 03-23-2008 08:05 PM |
| how can awk match multi pattern in a string | sleepy_11 | UNIX for Advanced & Expert Users | 5 | 03-16-2008 11:40 PM |
| how to use pattern match with grep | rei | UNIX for Dummies Questions & Answers | 5 | 01-05-2007 04:33 AM |
| vi/vim : complex pattern substitution | c444l | UNIX for Dummies Questions & Answers | 2 | 08-03-2004 11:04 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
pattern match and substitution, can you help?
pattern match and substitution, can you help?
file named test.txt I want to replace all the words Event with the word Fatal in all lines containing the word ERR - but I also want to keep the output of the other lines not matching ERR Test.txt: Event 13 INF egegegege Event 14 INF egegegege Event 15 ERR egegegege Event 16 MSG egegegege The output I want it: Event 13 INF egegegege Event 14 INF egegegege Fatal 15 ERR egegegege Event 16 MSG egegegege |
|
||||
|
Doesnt appear to work - any ideas?
bash-2.05# cat test.txt Event 13 INF egegegege Event 14 INF egegegege Event 15 ERR egegegege Event 16 MSG egegegege bash-2.05# sed -e '/ERR/{s_Event\(.*\)_Fatal\1_g}' test.txt sed: command garbled: /ERR/{s_Event\(.*\)_Fatal\1_g} |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|