xargs vs awk

so i tend to do this a lot:
[command to grab output] | awk '{print $1}' | xargs
to get a list of space seperated items. this is fine but something always niggles at me that i should just do this with awk. ;)

so i found i can do this:
[command to grab output] | awk '{printf $1" "
this is fine but it doesn't add a new line at the end.

so i can do this:
[command to grab output] | awk '{printf $1" "} END {print ""}'
so i have what i want... but now xargs is still shorter!

is there a simpler solution?

Comments

Popular posts from this blog

Want to export all *your* facebook data? you now can...

Writing valid/standard code

New Zealand bound