-
Notifications
You must be signed in to change notification settings - Fork 4
Home
hayeah edited this page Mar 8, 2011
·
6 revisions
Feel welcome to add whatever you like. I’d like a pet hippo.
p { cat "file.txt"; less }
rm(:r,find(". -name '*tmp'").map)
grep("-ir foo app").awk { puts line.split(":").first }
# or more rubyesque (preferred)
grep("-ir foo app").map { |l| puts l.split(":").first }
The `map` method converts a command into an array of output.
Whenever you want to use xargs, just use array of output as the arguments to the command. Like so:
cmd1(cmd2.map)
The arguments you give to a command is recursively normalized, so there’s a lot of flexibility in how the arguments are given. You can mix command output as arguments, as well as manually specifying arguments:
cmd1(cmd2.map,"arg1, arg2",:flag)
So on and so forth.