Web lists-archives.com

Re: Editing a piped in stream?




On 7/10/2018 2:16 PM, mick crane wrote:
On 2018-07-08 17:41, John Darrah wrote:
On 7/8/2018 7:00 AM, Richard Owlett wrote:

Until this thread I didn't have concept of "stream editor", much less the existence of "sed".
I had heard of "AWK", but had an image of it being a regex parser.

Awk is easy to learn because it is a minimal language. It can do
anything sed can do and much more. I am always surprised that so many
people opt to build long commands with cut/sed instead of using awk.
FWIW, I use mawk because it is orders of magnitude faster than gawk.

-- john


I'd like to learn some awk having found it handy once.
apt says mawk is installed

in /usr/bin I have
lrwxrwxrwx  1 root root         21 Apr  2 22:29 awk -> /etc/alternatives/awk
-rwxr-xr-x  1 root root     658072 Jan 25 12:55 gawk
-rwxr-xr-x  1 root root       3189 Jan 25 12:55 igawk
-rwxr-xr-x  1 root root     121976 Mar 23  2012 mawk
lrwxrwxrwx  1 root root         22 Apr  2 22:29 nawk -> /etc/alternatives/nawk

"awk" returns options for gawk and "mawk does nothing ( back to prompt)


At the end of those 'gawk' options:

"gawk is a pattern scanning and processing language.
By default it reads standard input and writes standard output."

$ printf "%s" "123 456 789" | awk '{print $2}'
456

--
John Doe