Sed
Still under construction
GREP substitute
sed -n /PATERN/p
Writing output to the input file
To write directly to the same file used as input, use the command option “-i“
mycomputer ~ $ echo '123' > testfile.txt
mycomputer ~ $ cat testfile.txt
123
mycomputer ~ $ sed -i s/123/abc/g testfile.txt
mycomputer ~ $ cat testfile.txt
abc
Print line 25 of a file
sed 25!d <file> or sed -n 25p <file>
(or awk NR==25 faces.txt or head -25 faces.txt | tail -1 )
To display system users & their default login shell, you will write:
sed -e 's/:.*:/:/' /etc/passwd
To list last logged in users except for root, you will write:
last | sed '/^root /d'
Sed tutorials
http://www.grymoire.com/Unix/sed.html