I present to you my cheat sheet of sed, the Superman of stream editing! It has come handy 101 times for me because sed is not what I use daily and after some time of not using the sed commands tend to fade away from my mind and I have to review them quickly. This cheat sheet is ideal for that!
You can’t really be a good hacker if you don’t know this tool. I always love to think of various situations where knowing many, many different tools makes you the ultimate guru.
Suppose you had a situation where you were on a box which had some problems and the only tool available to you was sed, and you had to fix a configuration file problem really quickly or bad, bad things would happen. If you never knew sed, you’d be in deep trouble because it can’t be learned from the man page, because it only lists all the commands and you have no understanding how the commands work.
When I first learned sed, I remember the joy when I understood how it worked, that it operated on input stream, output stream, pattern space and hold buffer. Once you know this, the rest can be understood from the man page, but before that, I doubt it.
If you want to learn the sed editor I recommend this wonderful tutorial and these books.
This sed cheat sheet contains:
- command line summary
- command description, if they take single address or pattern, or a range of addresses, and what they modify (input stream, output stream, pattern space or hold buffer)
- command line argument summary
- extensions
- short summary of adderss range format
If you notice any inaccuracies, mistakes or see that I have left something out, comment on this page, please!
Plain Text (.txt):
Download link: sed stream editor cheat sheet (.txt)
Downloaded: 2928 times
PDF:
Download link: sed stream editor cheat sheet (.pdf)
Downloaded: 7825 times
Microsoft Word 2000 format (.doc):
Download link: sed stream editor cheat sheet (.doc)
Downloaded: 1060 times
Are you interested in sed and unix text editing power tools? Here are three great books on this topic from Amazon:
< |
Did you like this post? Subscribe to my posts!
September 6th, 2007 at 7:14 pm
Great job. I’ve added it to http://TechCheatSheets.com
September 6th, 2007 at 7:57 pm
Hey, SR. Thanks so much for adding it to your site
September 21st, 2007 at 1:08 am
[…] Sed cheat sheet Filed under: BSD, Linux, Reference, Solaris — 0ddn1x @ 2007-09-20 22:08:44 +0000 http://www.catonmat.net/blog/sed-stream-editor-cheat-sheet/ […]
February 1st, 2008 at 8:15 pm
Nice post.