You're viewing a comment by Erik and its responses.
You're viewing a comment by Erik and its responses.
I am being sponsored by Syntress! They bought me an amazing dedicated server to run catonmat on. If you're looking web services, I highly recommend the Syntress guys!
I am being sponsored by A-Writer! If you ever need help with essay writing, look no further than A-Writer! They will help you with your writing in as quickly as 3 hours!
I love to read science books. They make my day and I get ideas for awesome blog posts, such as Busy Beaver, On Functors, Recursive Regular Expressions and many others.
Take a look at my
Amazon wish list, if you're curious about what I have planned reading next, and want to surprise me. :)
If you are interested in advertising on catonmat.net, contact me.
Free tools for coding on Vietstarsoft.com.
Programming homework help.


This is one that was driving me crazy - couldn't find it anywhere on the net:
DELETE ALL LINES BETWEEN TWO MARKER PATTERNS (but not the markers themselves):
e.g. in a hosts file
== /etc/hosts ==
192.168.1.2 host1
192.168.1.3 host2
### START ###
#delete
192.168.1.4 host3 #delete
192.168.1.5 host4 #delete
#delete
### END ###
192.168.1.6 host5
=============================
The money:
sed -i -e '1,/^### START ###/!{ /^### END ###/,/^### START ###/!d; }' /etc/hosts
I have no idea how it works, but it does. Now your markers are preserved for you to insert other stuff with your funky automation scripts.
Reply To This Comment