![]() |
|
|
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 |
| count a occurrence | soemac | Shell Programming and Scripting | 5 | 12-15-2008 06:10 AM |
| How to print lines till till a pattern is matched in loop | anoopvraj | Shell Programming and Scripting | 3 | 10-30-2008 10:36 PM |
| Using sed to substitute first occurrence | quixoticking11 | Shell Programming and Scripting | 2 | 07-09-2008 11:36 AM |
| Replace second occurrence only | lyoncc | Shell Programming and Scripting | 5 | 12-26-2007 11:21 PM |
| awk + last occurrence | agibbs | UNIX for Dummies Questions & Answers | 2 | 10-06-2007 04:32 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Hi,
In my file I have following to lines ------------------------------------------- C:/India/Apple/Mumbai/Red_Apple/Apple.txt cd C:/India/Apple && run ------------------------------------------- I want to replace "C:/India/Apple" with "D:/Test/Red_Apple" whereever the pattern "C:/India/Apple" occurs in my file. what I want is to capture the first occurrence of "Apple" after "C:" in the line. Please help me out. I am trying s/C:\/.*?Apple/D:\/Test\/Red_Apple/g but it is replacing "C:/India/Apple/Mumbai/Red_Apple/Apple.txt" to "D:/Test/Red_Apple.txt" Note: C:/India/Apple can be anything. Meaning it can be C:/India/Mango/Apple etc etc. Last edited by benitdhotekar; 06-03-2009 at 03:34 AM.. Reason: Updated |
| Bookmarks |
| Tags |
| regex |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|