3 ms·
> That's because numbers look better when they are right justified. They don't look better to a computer though. And that's what I don't get. Why are the defau
by sigil 15y ago
> That's because numbers look better when they are right justified.
They don't look better to a computer though. And that's what I don't get. Why are the defaults geared towards typesetting (human consumption) while cut/sort/join friendly output is so painful to produce?
This is a very common scenario when processing log files: line numbering, then sorting on another field followed by join/grep/head to grab a subset of interest, then recovering the original line numbers for the subset of interest.
Honestly half the time I end up doing this, just because it's the shortest invocation that comes to mind:
perl -lape '$_="$.\t$_"'
- __david__ 15y agoI've never heard of your use case before--that is interesting. Though I'm not sure I see why the "%5d" method is hard to parse... nl /usr/share/dict/words | head -20 | sort -n seems to work ok. "cut -f 2" and "cut -c 8-" also seem to work well in this case.