[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bash equivalent to DOS /p



Thomas Adam wrote:

--- Pete Clarke <pete@dynotechnic.co.uk> wrote:
Why not pipe the output through less .. eg:
#> cat somedoc.txt | less

Why would you want to cat the file _and_ page it? That is a useless use of
cat here, as less accepts STDIN.

1. Because it's a useful working example, unlike many others
2. I actually do just that sometimes. eg I cat a file and discover it's too long, so I back up and pipe it into less (or grep or awk or tail or head or head and tail).

Sometimes "cat  file|" is clearer than " <some very long command> <file"

eg
cat /etc/passwd | awk "/$USER/ {print \$0}"

Of course, the awk program could be quite a deal more complicate than that.

--

Cheers
John

-- spambait
1aaaaaaa@computerdatasafe.com.au  Z1aaaaaaa@computerdatasafe.com.au
Tourist pics http://portgeographe.environmentaldisasters.cds.merseine.nu/



Reply to: