awk tip

Write at 2017 Apr 23 in notes awk sort text processing duplicate

AWK is a powerful tool to process text data. In it, we can do control structure, loop, math calculatio like a real programming language.

Tips

Let’s say we have a csv file of 2 columns, we want to create a new columns. We an do that as this:

awk -F, '{$3=$1"-"$2; print}' file.csv

Sort by frequency

  cat $f/user.log | sort | uniq -c | sort -nr > $f/user_uniq.log

Want Email Forwarding For Your Domain? Check out Mailwip.