3 ms·
If you don't mind "cd dataset-directory" beforehand, a shorter and possibly more correct version would be: comm -1 -3 <(ls *_A.csv | sed 's/_.*$//') <(seq -w
by mklm 8y ago
If you don't mind "cd dataset-directory" beforehand, a shorter and possibly more correct version would be:
comm -1 -3 <(ls *_A.csv | sed 's/_.*$//') <(seq -w 0500) | sed 's/^0*//'
The OP's solution doesn't seem correct because of the different ordering of the two inputs of `comm': lexicographical (ls) and numeric (seq).
- mklm 8y agoAlthough -w is supported by both GNU and BSD versions of `seq', BSD's ignores leading zeros in input. Thus a more portable approach is: comm -1 -3 <(ls *_A.csv | sed 's/_.*$//') <(seq -f %04.f 500) | sed 's/^0*//'