3
4
I have a file with two columns separated by spaces like this:
potato 5
apple 7
pretzel 9
I want to issue a command on each line like this:
cmd -f potato -n 5
cmd -f apple -n 7
cmd -f pretzel -n 9
Can I get xargs
to split the incoming line and pass those arguments to a command? Is xargs
even the right command to use here?
works great and is simple enough that I can hope I'll eventually remember it... my question is, any easy modification to convert this working example
echo 11 22 | awk '{print "echo -f "$1" -n "$2}'
to have a CSV line input instead of space-delimited, like this:echo 11,22
? – nmz787 – 2019-08-29T01:53:43.083