Text Processing
cat
Concatenate and display file contents.
cat file.txt → Displays the content of file.txt.
grep [pattern] [file]
Search for a pattern in a file.
grep "error" log.txt → Searches for "error" in log.txt.
awk
Pattern scanning and processing language.
awk '{print $1}' file.txt → Prints the first column of file.txt.
sed
Stream editor for text manipulation.
sed 's/old/new/g' file.txt → Replaces "old" with "new" in file.txt.
sort
Sort lines of text files.
sort file.txt → Sorts the lines in file.txt.
cut
Remove sections from each line of a file.
cut -d',' -f1 file.csv → Extracts the first column from file.csv.
uniq
Report or omit repeated lines.
uniq file.txt → Removes duplicate lines from file.txt.
tr
Translate or delete characters.
tr 'a-z' 'A-Z' → Converts lowercase letters to uppercase.
wc
Count lines, words, and characters in a file.
wc file.txt → Displays the line, word, and character count of file.txt.
tee
Read from standard input and write to standard output and files.
`echo "Hello"
Last updated