Yaman.. you rock!!

Thank you.

PS: only the third method worked with me. First complained about
subdirectories not being regular files. The second complained about
unexpected token perl.

On 12/24/06, Yaman Saqqa <[EMAIL PROTECTED]> wrote:

However you like:

1) Plain old globbing: perl -i -pe 's/oldClass/newClass/g'
/path/to/files/*
2) Loop: for f in `ls -1 /path/to/files/*.ext` do; perl -i -pe
's/oldClass/newClass/g' $f; done
3) The nifty find: find /path/to/files -name '*.ext' -print -exec perl -i
-pe 's/oldClass/newClass/g' {} \;
Note that this will recurse use -maxdepth 0 for that directory only.


Btw .. I did not test those ... I just wrote them here ... so a proof read
will be good, and copy ur files somewhere else as a safe precaution whenever
you are doing in-place replacements :D

Enjoym

On 12/24/06, Al-Faisal El-Dajani <[EMAIL PROTECTED]> wrote:
>
> Thanx... but how can i make that command recurse over all files within a
> specific folder?
>
> On 12/24/06, Yaman Saqqa < [EMAIL PROTECTED]> wrote:
> >
> > perl -i -pe 's/oldClass/newClass/g' FileName
> >
> > On 12/24/06, Al-Faisal El-Dajani < [EMAIL PROTECTED] > wrote:
> > >
> > > Hello,
> > >
> > > I am in the middle of writing a somewhat large system, and midway
> > > had to modify the class that i was using. I inherited it, altered it and 
now
> > > i need to use the new child class in all my files. I think this command
> > > would do the trick:
> > >
> > > cat FileName > temp; cat temp | sed -e "s/oldClass/newClass/g" >
> > > FileName;
> > >
> > > How can i make this command run recursively on all files within a
> > > specific folder? Substituting FileName with actual file names and altering
> > > the files?
> > >
> > > Any help would be deeply appreciated.
> > >
> > > --
> > > Al-Faisal El-Dajani
> > > P.O Box: 140056
> > > 11814 Amman, Jordan
> > >
> > >
> >
> >
> > --
> > abulyomon
> >
> > www.KiLLTHeUPLiNK.com
> >
> >
>
>
> --
> Al-Faisal El-Dajani
> P.O Box: 140056
> 11814 Amman, Jordan
>
>


--
abulyomon

www.KiLLTHeUPLiNK.com
>



--
Al-Faisal El-Dajani
P.O Box: 140056
11814 Amman, Jordan

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Jolug" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups-beta.google.com/group/Jolug?hl=en-GB
-~----------~----~----~----~------~----~------~--~---

رد على