[prev in list] [next in list] [prev in thread] [next in thread] 

List:       aix-l
Subject:    Re: best way to replace text in a lot of files?
From:       Tim Brumfield <brumfit () DFA ! STATE ! MS ! US>
Date:       2007-05-31 14:48:23
Message-ID: 465E99E6.58DC.0013.0 () dfa ! state ! ms ! us
[Download RAW message or body]

That worked great John! Thanks a million!

>>> John Dunn <JDunn@SEFAS.COM> 5/31/2007 8:42:56 am >>>
Try escaping the slashes in your path using a backslash.... 


John Dunn

Product Consultant

Sefas Innovation Limited

Direct Dial + 44 (0) 117 373 6122

www.sefas.com 

Sefas Innovation Ltd, CityPoint, Temple Gate, Bristol BS1 6PL, UK. Tel:
+44 (0) 117 373 6114 Fax: +44 (0) 117 373 6115

Sefas Innovation Limited.  Registered No: 3769761 England.  Registered
Office: One New Street, Wells, Somerset, BA5 2LA, United Kingdom.  VAT
Registration No: GB 741 5377 32

Unless stated to be non-confidential, this email and any attachments are
private and confidential and are for the addressee only. Sefas monitors
e-mails to ensure its systems operate effectively and to minimize the
risk of viruses. Whilst Sefas has taken reasonable steps to scan this
email, it does not accept liability for any virus that may be contained
in it.

Internet communications are not 100% secure and as such Sefas is not
responsible for their abuse by 3rd parties, nor for any alteration or
corruption in transmission.

 


-----Original Message-----
From: IBM AIX Discussion List [mailto:aix-l@Princeton.EDU] On Behalf Of
Tim Brumfield
Sent: 31 May 2007 14:39
To: aix-l@Princeton.EDU 
Subject: Re: best way to replace text in a lot of files?

John, is there a way to change the "/" delimiter, since the forward
slash is part of my "edit"? Thanks!

>>> John Dunn <JDunn@SEFAS.COM> 5/31/2007 8:14:06 am >>>

find mydirectory -name "*.*" -print | xargs perl -pi.bak -e
's/oldstring/newstring/g' 


This also creates a .bak version of any file it changes


John 

 


-----Original Message-----
From: IBM AIX Discussion List [mailto:aix-l@Princeton.EDU] On Behalf Of
Tim Brumfield
Sent: 31 May 2007 14:09
To: aix-l@Princeton.EDU 
Subject: best way to replace text in a lot of files?

I need to change a path in a lot of text files. Does anyone have a shell
script to do something like this? As an example, I would be changing
"/dbadmin/test/financial/scripts" to "/financial/scripts". I have
hundreds of files to change. I am running aix5.3. Thanks in advance!



-tim


wise man say:
wife who often send man to doghouse may one day find him in cathouse...
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic