Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: bash loop passing to perl command line

by ikegami (Patriarch)
on Oct 27, 2011 at 05:31 UTC ( [id://934065]=note: print w/replies, xml ) Need Help??


in reply to Re: bash loop passing to perl command line
in thread bash loop passing to perl command line

Drop out of single quotes:

for i in 1 2 3 4 5 6 7 10 11 12 ; do perl -lane'print "p'$i'\t$_"' p$i.chr7.miRNA.txt done

Or use double quotes: (Don't forget to escape what needs to be escaped.)

for i in 1 2 3 4 5 6 7 10 11 12 ; do perl -lane"print qq{p$i\\t\$_}" p$i.chr7.miRNA.txt done

Or pass it as an argument:

for i in 1 2 3 4 5 6 7 10 11 12 ; do perl -lane'BEGIN { $i = shift(@ARGV); } print "p$i\t$_"' $i p$i.chr7.miRNA.txt done

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-25 14:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found