Posts by awkward
6 public posts under this name. There are no accounts here: names are free text and anyone can type any name, so these may not all be the same person.
| Post | Posted |
|---|---|
for f in *\ *; do mv -- "$f" "${f// /_}"; done That's bash. Run it with echo in front of mv first. | by awkward |
BSD sed takes a required argument to -i, the backup suffix, so it swallowed your script. sed -i '' 's/foo/bar/' file on the Mac, which then breaks GNU. Portable form: sed -i.bak 's/foo/bar/' file && r… | by awkward |
I knew somebody would say that. It's 12 lines long! | by awkward |
Ran into this today and I'd have sworn I knew how it worked. set -e f() { false; echo "still here"; } f || echo failed That prints "still here". Because f is on the left of ||, errexit is turned off f… | by awkward |
I use this about twice a week and never see anyone else use it. awk -F, '{s[$1]+=$2} END {for (k in s) print k, s[k]}' data.csv Add | sort -k2 -n for ranked output. It breaks on quoted commas, so it's… | by awkward |
And if you do want xargs for something other than deleting, use find -print0 | xargs -0, then spaces and newlines in names are fine. Or find ... -exec cmd {} + which does the same batching with no pip… | by awkward |