Previous Section  < Day Day Up >  Next Section

sed—streamlined editor


sed [–n] [–e script] [–f sfilename] [filename ...]


sed copies the named filename (standard input default) to the standard output, edited according to a script or command. Does not change the original file.

Example A.49.

1   sed 's/Elizabeth/Lizzy/g' file

2   sed '/Dork/d' file

3   sed -n '15,20p' file


EXPLANATION

  1. Substitute all occurrences of Elizabeth with Lizzy in file and display on the terminal screen.

  2. Remove all lines containing Dork and print the remaining lines on the screen.

  3. Print only lines 15 through 20.

    Previous Section  < Day Day Up >  Next Section