[TCC]$ : sed basics [TCC]$ : Many commands put something on screen like [TCC]$ echo Today is %DATE% Today is 2013-06-25 [TCC]$ : Sed accepts piped input and does things to it [TCC]$ : It can print a line number before each line: [TCC]$ echo Today is %DATE% | sed "=" 1 Today is 2013-06-25 [TCC]$ : It can print something above or below a line [TCC]$ echo Hello, world. | sed -e "1i ABOVE IT" -e "$a and BELOW it" ABOVE IT Hello, world. and BELOW it [TCC]$ : In front or after it .... [TCC]$ echo Hello, world | sed "s/^/IN FRONT::|/; s/$/|::AFTER/" IN FRONT::|Hello, world|::AFTER [TCC]$ : It can delete everything but certain lines, [TCC]$ : like here is the last line of a help file: [TCC]$ for /? | sed "$!d" /L (counted loop) [TCC]$ : It really shines at substitutions [TCC]$ echo Today is %DATE% | sed "s,-,/,g" Today is 2013/06/25 [TCC]$ : Or it can swap things around [TCC]$ echo Today is %DATE% | sed -r "s/([^ ]+) ([^ ]+) ([^ ]+)/\3 \2 \1/" 2013-06-25 is Today [TCC]$ : sed can do lots more. The End.