in reply to Re(4): Need one-liner to s///g in all sub-dirs
in thread Need one-liner to s///g in all sub-dirs

All of which brings my to my tired question (revised a little each time). And I ask again because this part is still not clear. Assuming that the files are already backed up, does not this simple line:
 
%perl -pie 's/old/new/g' ./*/*

 
It comes close ... what this line does not do is act on the files of the sub-directories of your sub-directories. Wih your original method, files in the current directory and its immediate subdirectories are being acted upon, but no further. No files in subdirectories therein would be acted upon, negating the 'all sub-directories' requirement of your one-liner. Depending on your directory structure, this could leave a large number of files untouched.
 
The best way to describe this is through example. From the /usr directory of my mail server:
 
budapest:/usr# ls -l ./*/* | wc -l 4505 budapest:/usr# find . -type f -print | wc -l 22838

 
The difference in number of files is quite apparent - If however, you have no further subdirectories beneath those of your current directory, then there should be no problems, but if there is, potentially a large number of files could be missed.
 

 
Ooohhh, Rob no beer function well without!

Replies are listed 'Best First'.
Re(6): Need one-liner to s///g in all sub-dirs
by dvergin (Monsignor) on Aug 25, 2001 at 10:08 UTC
    When I originally said, "all files in all subdirectories of the current directory" I can see now that that was ambiguous and was no doubt the cause of some of the confusion. I should have said "all the files in the immediate subdirectories of the current directory."

    With that clarification, I think I understand you that the latest version of my proposal will do the job just fine.

    ...Thank you.