![]() |
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 |
| Mac OS X 10.5: Time Machine - "The backup volume could not be found" alert | iBot | OS X Support RSS | 0 | 06-25-2009 01:15 PM |
| Mac OS X 10.5.3 or later: Time Machine - "Backup volume could not be mounted" after c | iBot | OS X Support RSS | 0 | 10-14-2008 03:50 PM |
| How do I connect a hpux10.x os machine to "the internet" via a WinXP client? | liumx2000 | UNIX for Dummies Questions & Answers | 0 | 08-22-2008 12:34 AM |
| Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" | Lokesha | UNIX for Dummies Questions & Answers | 4 | 12-20-2007 01:52 AM |
| how to "remsh" from a Unix machine to a Linux or SunOS | elthox | UNIX for Dummies Questions & Answers | 2 | 10-09-2007 09:22 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Using "sed" to update RECURSIVELY a value within a directory in a Red Hat Machine
Hi All,
I spent the whole morning trying to create a shell script ( using "sed" command ) that looks for a value in a directory and its sub directory than changes it with another value but couldn't find the way ![]() a first step, allowded me to trace all the files that contain it and even change this value but not into the file but on the standard output ( the screen ), here after the command : grep -R 10.220.22.240 * | grep 8080 | sed 's/10\.220\.22\.240/localhost/g' RESULT ON SCREEN ( here after a single line for exemple ): papers-papers.htm: <li><a href="http://localhost:8080/display/Jd/Publications+in+2007">2007</a></li> Now, what i'am attempting to do, is to change the value "10.220.22.240" with "localhost" INTO ALL THESE FILES !!! i made this script below but i shoul be missing something : =========================== #!/bin/ksh grep -R 10.220.22.240 * | grep 8080 > ListaFile for a in ListaFile do sed 's/10\.220\.22\.240/localhost/g' < a > b ========== one of the line included in "ListaFile", gives : ============== testo/nav-up.htm_al13gen09:<td width="82" bgcolor="#6699CC"><div align="center"><a href="http://10.220.22.240:8080/dashboard.action" target="content" class="menu" on Click="MM_showHideLayers('comm','','hide','description','','hide','board','','hide','application','' ,'hide','papers','','hide','news','','hide','wiki','','show')" > wiki</a></div></td> ============== Can you help please ? thanx Last edited by mehdi1973; 07-02-2009 at 09:16 AM.. |
|
||||
|
Thank you so much, i tried it AND IT WORKS, THATS GREAT
![]() |
| Sponsored Links | ||
|
|