Re: Extend cat to have headers like head/tail
Bob Proulx bob-5cAygf9QrE/qt0dzr+a...@public.gmane.org writes: Erik Auerswald wrote: Eric Lavarde wrote: to check multiple files I often tend to use 'cat *somefiles*' but it's all concatenated and difficult to read, so I switch back to 'head -nSOMETHINGBIG *somefiles*' but it's not optimal and I might miss lines if a file is bigger than expected. Try head -n-0. I like it! This is non-standard. tail -n+1 is portable. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 And now for something completely different.
Re: Extend cat to have headers like head/tail
Andreas Schwab wrote: Bob Proulx writes: Erik Auerswald wrote: Try head -n-0. I like it! This is non-standard. tail -n+1 is portable. Yes. That is better. (I did know about tail -n+1 but had forgotten about it. Thanks for the reminder.) Bob
Re: Extend cat to have headers like head/tail
Erik Auerswald wrote: Eric Lavarde wrote: to check multiple files I often tend to use 'cat *somefiles*' but it's all concatenated and difficult to read, so I switch back to 'head -nSOMETHINGBIG *somefiles*' but it's not optimal and I might miss lines if a file is bigger than expected. Try head -n-0. I like it! I did not know about that possibility before. Thank you for sharing it. I would have suggested it if I had known about it. Bob
Re: Extend cat to have headers like head/tail
Hi Eric, On Fri, May 10, 2013 at 09:18:27AM +0200, Eric Lavarde wrote: to check multiple files I often tend to use 'cat *somefiles*' but it's all concatenated and difficult to read, so I switch back to 'head -nSOMETHINGBIG *somefiles*' but it's not optimal and I might miss lines if a file is bigger than expected. Try head -n-0. HTH, Erik
Extend cat to have headers like head/tail
Hi, to check multiple files I often tend to use 'cat *somefiles*' but it's all concatenated and difficult to read, so I switch back to 'head -nSOMETHINGBIG *somefiles*' but it's not optimal and I might miss lines if a file is bigger than expected. Would it be possible to add an option '--header' to cat so that it separates multiple files with headers containing filenames, exactly like head and tail do? It wouldn't be the behavior by default obviously so that it wouldn't break anything. Thanks, Eric