5 ms·
This! I was doing some work with a colleague and he was showing off some bash knowledge. I know a bit but my experience is limited since my last job was a Windo
by wirthjason 5y ago
This! I was doing some work with a colleague and he was showing off some bash knowledge. I know a bit but my experience is limited since my last job was a Windows a shop.
We did a bunch of stuff with “xargs”. He said it was the one misunderstood command. One of the cool things was the ability to parallelize the work with a simple -P flag.
You do a find, make sure to use the -print0 flag, pipe it into xargs and use the -0 option then run a command over all the files. If you add -P it magically becomes parallel.
- throwaway0a5e 5y agoxargs and awk are two commands I really regret using as little as I do.
- ZephyrP 5y agoI know awk (well, gawk) pretty well and I still regret not having just learned perl.
- brokenmachine 5y agoI really hate the way there's no standard flags, so you have to remember that find is -print0 while xargs is -0 and something else might be -null. I spend half my time trying to find the right arguments and the whole time wishing I just bit the bullet at the start and used a real programming language. And god forbid if a filename might have a quote character or a space in it. Then you have to think 5x as hard about what you're doing.