Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Default field separators
    • Tab is the default field separator for cut
    • spaces whitespace(one or more spaces or tabs) is the default field separator for awk
      • note that some versions of awk do not include tab as a default delimiter
  • Re-ordering
    • cut cannot re-order fields; awk can, based on the order you specify
  • awk is a full-featured programming language while cut is just a single-purpose utility.

...

  • -v  (inverse) – only print lines with no match
  • -n  (line number) – prefix output with the line number of the match
  • -i  (case insensitive) – ignore case when matching alphanumeric characters
  • -c  (count) – just return a count of the matches
  • -L  – instead of reporting each match, report only the name of files in which a no match is found
    • handy for checking a bunch of log files for errors or success
  • -A  (After) and -B (Before) – output the specified number of lines before and after a match

...