Hacker News new | past | comments | ask | show | jobs | submit login

The author has earned him/herself a Useless Use of cat (UUOC) award for not realizing that grep can take a filename argument in the example pipeline.

Basically, the example can be shortened to the following:

    grep purple /usr/share/dict words | # Find words containing 'purple' in the system's dictionary
    awk '{print length($1), $1}' |      # Count the letters in each word
    sort -n |                           # Sort lines ("${length} ${word}")
    tail -n 1 |                         # Take the last line of the input
    cut -d " " -f 2 |                   # Take the second part of each line
    cowsay -f tux                       # Put the resulting word into Tux's mouth



Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: