The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to find a file named vijay in a directory using find command amirthraj_12 UNIX for Dummies Questions & Answers 6 10-25-2008 12:37 PM
find and replace string in a directory files koti_rama Shell Programming and Scripting 2 05-30-2008 03:48 AM
Find/replace to new file: ksh -> perl McLan Shell Programming and Scripting 1 05-16-2008 03:14 AM
perl find directory only if modified in last hour frustrated1 Shell Programming and Scripting 0 10-12-2007 04:50 PM
Parentheses in perl find/replace Jeffish Shell Programming and Scripting 3 08-21-2007 11:10 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-20-2008
Registered User
 

Join Date: Jul 2006
Posts: 14
how to use sed or perl command to find and replace a directory in a file

how to use sed command to find and replace a directory



i have a file.. which contains lot of paths ...

for eg.. file contains..

/usr/kk/rr/12345/1
/usr/kk/rr/12345/2
/usr/kk/rr/12345/3
/usr/kk/rr/12345/4
/usr/kk/rr/12345/5
/usr/kk/rr/12345/6
/usr/kk/rr/12345/7
/usr/kk/rr/12345/8

i want to replace /usr/kk/rr/12345/ with /usr/kk/yy/12555/

pls help
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-20-2008
Registered User
 

Join Date: Apr 2008
Location: Chennai,India
Posts: 77
Code

Try this

Quote:
sed -e 's/rr/yy/g;s/12345/12555/g' file.txt
Reply With Quote
Google The UNIX and Linux Forums
Reply

Bookmarks

Tags
None

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:




All times are GMT -4. The time now is 12:10 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66