2 ms·
/me runs the example on bigbash.it, cleaned up a bit: ( trap "kill 0" SIGINT; export LC_ALL=C; find movies.dat.gz -print0 | xargs
by Groxx 4y ago
/me runs the example on bigbash.it, cleaned up a bit:
(
trap "kill 0" SIGINT;
export LC_ALL=C;
find movies.dat.gz -print0
| xargs -0 -i sh -c "gzip -dc {} | tail -n +2"
| sed "s/::/;/g"
| cut -d $';' -f2
| sort -t$';' -k 1,1
| head -n10
| awk -F ';' '{print $1}'
)
Yeah, how about no. That's a very neat site and a clever hack, but there are clear escaping flaws in there for valid movie names.
bash and standard unix tools are a terrible structured-data manipulator. it's part of why `jq` is so widely used and loved, despite being kinda slow and hard to remember at times - it does things correctly, unlike most glued-together tools.
- aasasd 4y agoYep, pretty sure that this script doesn't handle quoted strings in any way, and would promptly mangle a title that contains a semicolon.