I'm Vinh, a husband, father& programing enthusiat

awk tip

Vinh  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.


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