Here’s a quick little awk
trick to have in your arsenal: if you want to search through a bunch of files, but only want to show the lines that exceed X amount of characters, you can use awk
's built-in length
check.
For instance:
$ awk 'length > 350' $ awk 'length < 50'
If you combine this with a grep
, you can do things like “show me all the lines that match TXT and that exceed 100 characters in length".
$ grep 'TXT' * | awk 'length > 100'
Super useful to quickly skim through a bunch of logs or text-files.