Working with text
Word count
Word (-w
), line (-l
), character (-m
) and byte (-c
) count for file or piped input
Sort
Sort lines of text in standard or reverse order (-r
)
Sort by numerical (-n
) or general numerical values (-g
handles floating points)
Unique
Filter out repeat / duplicate lines that are adjacent (-c
to output repeated count for each entry)
Sort lines first to position duplicate lines together for removal
Show ordered count of each repeated line (filtering out single non-repeated lines)
Text replace
Pipe text into tr
to replace content (eg. replace commas with new lines)
Text extract
Output printable strings contained in file (useful for extracting metadata from binary files)
Grep
Search and output matching strings (case insensitive -i
, display line numbers -n
)
Search and output multiple matching strings
Pipe content into grep (eg. via cat
or echo
)
Show context lines after (-A
), before (-B
) or both sides (-C
) of search results
awk
Print the first (or second $2
, third $3
etc) field / word token for each line
Print lines longer the <length>
characters (eg. 200)
Last updated