manpagez: man pages & more
info sed
Home | html | info | man

File: sed.info,  Node: Examples,  Next: Limitations,  Prev: advanced sed,  Up: Top

7 Some Sample Scripts
*********************

Here are some ‘sed’ scripts to guide you in the art of mastering ‘sed’.

* Menu:


Useful one-liners:
* Joining lines::

Some exotic examples:
* Centering lines::
* Increment a number::
* Rename files to lower case::
* Print bash environment::
* Reverse chars of lines::
* Text search across multiple lines::
* Line length adjustment::
* Adding a header to multiple files::

Emulating standard utilities:
* tac::                             Reverse lines of files
* cat -n::                          Numbering lines
* cat -b::                          Numbering non-blank lines
* wc -c::                           Counting chars
* wc -w::                           Counting words
* wc -l::                           Counting lines
* head::                            Printing the first lines
* tail::                            Printing the last lines
* uniq::                            Make duplicate lines unique
* uniq -d::                         Print duplicated lines of input
* uniq -u::                         Remove all duplicated lines
* cat -s::                          Squeezing blank lines

© manpagez.com 2000-2026
Individual documents may contain additional copyright information.