Hacker News new | ask | show | jobs
by thebigpicture 5028 days ago
fmt 1 < file seems like it might be handy

i don't understand his first one though. i thought both linux and bsd greps had the -H option (show filename).

here's some more:

   1. sed t file instead of cat file

   2. echo dir/*|tr '\040' '\012' instead of find dir

   3. echo dir/*|tr '\040' '\012' |sed 's/.*/program & |program2 /' > file; . file instead of xargs or find
(of course this assumes you keep filenames with spaces or other dangerous characters off your system.)

   4. same as 3. but use split to split file into parts.  then execute each part on a different cpu.
1 comments

The point of the first one is he's abusing grep as cat; what he really wants is a cat that shows filenames, but since there's no such thing he uses "grep ." as a substitute.