1 / 9

diff , wc , and sed

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.

ursula-dean
Download Presentation

diff , wc , and sed

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. diff, wc, and sed

  2. 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

  3. diff Example • From file1, delete lines 2 and 3 • From file1, delete line 5

  4. diff Example • In file2, add the following in lines 2 and 3 • In file1, add the following in line 5

  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

  6. 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.

  7. sed Examples

  8. sed Examples

  9. sed Resources • http://www.student.northpark.edu/pemente/sed/sed1line.txt • http://www.grymoire.com/Unix/Sed.html

More Related