0

I don't really know awk, but my attempt so far

history | awk '!x[<everything except first column which is the order>]++' | sort -r

1 Answers1

2

Does it need to be awk?

history | tail -n 50 | sort -r -n | cut -d " " -f4- | sort -u

basically

  1. Reverse Sort history using the numeric prefix
  2. Remove spaces
  3. Remove leading numbers
  4. Remove duplicates

Alternatively, you can do the following based on this previously answered question

history | sort -rn | sed -e 's/ *[0-9][0-9]* *//' | uniq | less