
Chart of similar operations with sed and awk - shawndumas
http://www.pement.org/awk/awk_sed.txt
======
cogburnd02
(A) I'm not sure why this list uses DOS environment variables rather than bash
environment variables, and

(B) IIRC, 'gensub' is 'gawk'-specific.

Other than that, awesome stuff. :-D

------
kylek
Also see
[https://www.gnu.org/software/gawk/manual/html_node/Clones.ht...](https://www.gnu.org/software/gawk/manual/html_node/Clones.html)
for a few unix text processing commands implemented in awk

------
kilowatts
I have no idea how to use any of this. Fortunately, there's even more files in
the directory, one level up!

[http://www.pement.org/awk/](http://www.pement.org/awk/)

[https://en.wikipedia.org/wiki/Awk](https://en.wikipedia.org/wiki/Awk)

    
    
      AWK was preceded by sed (1974). Both were designed 
      for text processing. They share the line-oriented, 
      data-driven paradigm, and are particularly suited to 
      writing one-liner programs, due to the implicit main 
      loop and current line variables.
    

I feel like line-oriented programming tools are a silly idea, limiting
activities to plain text ASCII. More file formats don't involve new line
characters than do, no?

Also, is there any reason to prefer sed over awk, when awk is available? Is
awk ever not available?

~~~
kylek
I don't remember where I read it, but basically - sed can do everything grep
does, and more; awk can do everything sed does, and more. There are definitely
faster alternatives for more specific use cases, but awk is very general.

I mostly use sed with -i (for in-place editing) when I need a simple operation
done quickly on a file without having to think about redirection/etc.

I personally spend a lot of time in the command line working with plain ascii
text, and can tell you that awk combined with other commands like find and
xargs (or for loops) are my go-to tools. Obviously quick-and-dirty, but
powerful and usually get the job done.

~~~
gumby
Personally I prefer the terseness of sed and only use awk when I can't use sed
(or a pipeline of sed commands).

------
snarfy
At the company I landed my first programming job, they had an application that
was 100k+ lines of ksh, sed and awk.

~~~
ExpiredLink
Everyone can use C and Python but _we_ do it differently.

