![]() |
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 |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| match nearest | bogu0001 | UNIX for Dummies Questions & Answers | 1 | 02-13-2009 04:42 AM |
| pattern match | tostay2003 | Shell Programming and Scripting | 3 | 12-31-2008 01:47 PM |
| awk or sed for finding closest pattern to a line number | alirezan | Shell Programming and Scripting | 1 | 10-11-2008 07:08 AM |
| how do i pattern match a field with awk? | someone123 | Shell Programming and Scripting | 4 | 06-03-2008 09:08 AM |
| pattern match and substitution, can you help? | frustrated1 | Shell Programming and Scripting | 4 | 02-20-2006 08:48 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
sed match closest/nearest pattern
All
i am struggling to raplace some text in a line between two (closest) patterns , Code:
line="/home/usr/bin/:/home/usr/devuser,n1.9/bin:/home/usr/root/bin" i tried teh following Code:
echo $line | sed 's/devuser.*\//NEWVAL\//' where i am expecting /home/usr/bin/:/home/usr/NEWVAL/bin:/home/usr/root/bin" i know sed will match the longest possible pattern, i tried this as well Code:
echo $line | sed 's/devuser.*[^\/]/NEWVAL/' ![]() any help will be appreciated. Thanks in advance. ---------- Post updated at 02:13 AM ---------- Previous update was at 01:30 AM ---------- hey guys, found something Code:
echo $line | sed 's/devuser[^\/]*/NEWVAL/' any other suggestions are welcome. Last edited by otheus; 07-02-2009 at 04:59 AM.. Reason: added code tags |
| Bits Awarded / Charged to sudheer1984 for this Post | |||
| Date | User | Comment | Amount |
| 07-02-2009 | otheus | posting own solution | 500 |
![]() |
| Bookmarks |
| Tags |
| sed nearest mtach between two words |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|