![]() |
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 |
| Interference channel capacity region for randomized fixed-composition codes | iBot | UNIX and Linux RSS News | 0 | 02-08-2009 07:10 AM |
| Interference channel capacity region for randomized fixed-composition codes | iBot | UNIX and Linux RSS News | 0 | 11-26-2008 07:30 AM |
| How can i take private region backup in veritas | younus_syed | SUN Solaris | 3 | 09-05-2008 07:26 AM |
| Finding volumes with mirrored DRL(Dirty Region Log) | prasi_in | UNIX for Advanced & Expert Users | 2 | 05-26-2008 08:58 AM |
| stack region | yakari | UNIX for Advanced & Expert Users | 2 | 12-29-2006 09:34 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Can sed perform editing operations ONLY in the matched region?
Hi:
Let's suppose I want to replace all the | by > ONLY when | is between []. Usually (and it works) I would do something like sed -e 's/\(\[[^|]*\)|\([^[]*\]\)/\1>\2/g' where I have to "save" some portions of the matched region and use them with the \n metacharacter. I was wondering if I could execute something like that SelectTheFragmentsThat Match(/\[[^]]*\]) and then execute in those pieces s/|/>/g and left the rest of the line unchanged So, a lot of times I want to perform only editing operations in the region matched, and I want lo left thje rest of the line unchanged. Is that possible? Thanks a lot Isi |
|
||||
|
Original text
AAAA [one|1] BBBB | CCCCC [two|2] DDDDD desired result AAAA [one>1] BBBB | CCCCC [two>2] DDDDD only the | between [] are changed. I know how to perform the chage (see my post) but I would like to know if it exists a more "intuitive" way in sed. Thanks a lot Isi |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|