Text Searching and Manipulation
grep
- searches files or directories for a RegEx and output any line matching
sed
- can modify a stream of text
- E.g:
echo "I need to try hard" | sed 's/hard/harder'
cut
- extract a section from a line
echo "I hack binaries,web apps,mobile apps, and just about anything else" | cut -f 2 -d ","
-f
→ field number to cut out-d
→ delimiter
awk
- text processing used for data extraction and reporting
echo "hello::there::friend" | awk -F "::" '{print $1, $3}'
→hello world
- compared to
sed
,awk
supports multiple delimiters
Relevant Note(s): Linux Basics