Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Recursive File Substitution

by hacker (Priest)
on Jul 12, 2002 at 12:48 UTC ( [id://181250]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Recursive File Substitution
in thread Recursive File Substitution

..slightly different:
perl -pi.orig -e 's/\cM//g' `find . -type f`

Replies are listed 'Best First'.
Re: Recursive File Substitution
by Abigail-II (Bishop) on Jul 12, 2002 at 13:24 UTC
    That's not going to work if you have filenames with spaces in them. Piping it through xargs -0 (and don't forget the -print0 option for find) works better, although you will still have problems with filenames ending or beginning with a pipe symbol, beginning with a greater than or less than symbol, files named -, or files beginning or ending with whitespace. All due to the magic open (All hail magic open!).

    We can however do the substitution without a body:

    find . -type f -print0 | xargs -0 perl -0777lpwi.bak -015e' '

    Abigail

Re: Re: Recursive File Substitution
by jdavidboyd (Friar) on Jul 12, 2002 at 15:17 UTC
    You mean that this little bitty one liner does everything that the huge program above does?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://181250]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2024-03-28 22:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found