90 likes | 280 Views
diff , wc , and sed. The diff Command. The diff command compares two files and displays the differences. Indicates whether lines need to be added or deleted to make the files identical. diff Example. From file1, delete lines 2 and 3 From file1, delete line 5. diff Example.
E N D
The diff Command • The diff command compares two files and displays the differences. • Indicates whether lines need to be added or deleted to make the files identical
diff Example • From file1, delete lines 2 and 3 • From file1, delete line 5
diff Example • In file2, add the following in lines 2 and 3 • In file1, add the following in line 5
The wc Command • The word count command displays the number of lines, words, bytes (characters) in a file. • 33 lines • 223 words • 1320 characters • wc –l file1 • wc –w file1 • wc –c file1 • wc –m file1
The sed Command • The sed utility reads lines of a text file, one by one. • It applies a set of editing commands to the lines without opening the file in a text editor.
sed Resources • http://www.student.northpark.edu/pemente/sed/sed1line.txt • http://www.grymoire.com/Unix/Sed.html