CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
perl filenames with & (ampersand)

 



ashah7
New User

Mar 13, 2015, 3:47 AM

Post #1 of 2 (3943 views)
perl filenames with & (ampersand) Can't Post

Hi All

Im trying to run a command on many file using bash

create the function

myfunc() {

tail -c 128kB "$1" | md5sum | perl -pe 's&-&'"$1"'&'

}

find . -type f | xargs -0 -P 0 -I name bash -c 'myfunc "name"'

this works fine and the function is run correctly against all the files found

But when a "&" is encountered in the filename the scripts faults

any help appreciated


FishMonger
Veteran / Moderator

Mar 13, 2015, 5:57 AM

Post #2 of 2 (3940 views)
Re: [ashah7] perl filenames with & (ampersand) [In reply to] Can't Post

Use a different deliminator in the regex.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives