awk

One-liners in Python? Not a chance!

When I recently told someone that I often use awk when I write shell scripts, the comment, together with a raised eyebrow, was "So, anyone's still using this?!" I felt a bit old-fashioned, and when today I caught myself writing a one-liner in awk I decided to give Python a chance (yes, I know, there is also Perl, but I never give Perl another chance :-/).

The problem I wanted to solve was splitting a comma-separated list into a whitespace separated list of words that I could use for iteration in the shell. The awk one-liner I came up with after 1 minute was this: