Format | Head |Tail
fmt filename
collecting all the words and making it us a paragraph
fmt -u filename
Removing unwanted spaces and making it us a paragraph
Head
head filename
head filename1 filename2
it display first 10 values. because default value is 10
head -q filename filname2
it display first 10 values in each file and name cannot be displayed.
Tail
tail -n 3 filename
It display last 3 values
tail -f filename
it will display realtime values
Numbering
nl filename
It will display the content with numbers and only used for numbering purpose.
nl -s "/" filename
to add a string using -s .
Split
split filename
It will split the content then create new file and it will save the splitted content into the new file.
split -l2 tech.txt split1.txt
It will split the content with two lines then create the new file and saved it into the splitted content.
Tac
tac filename
it will reverse the content
Last
last
displays a list of all users logged in (and out) since that file was created.
Translate
tr
Translate, squeeze, and/or delete characters from standard input, writing to standard output.
tr [a-z] [A-Z] < tech.txt | head -n 3 > translated.txt
Sed
sed βs/unix/linux/β sample1.txt
sed 's/unix/linux/g' sample1.txt
stream editor for filtering and transforming text.A stream editor is used to perform basic text transformations on an input stream (a file or input from a pipeline). g β> globally change the content without g it will change only first word. s -> search.
Paste
paste -d "||" state.txt tech.txt | head -n 3
Merge lines of files. Write lines consisting of the sequentially corresponding lines from each FILE, separated by TABs, to standard output.
d β> delimeter , β|β it seperate the two merged files.