[OT] Unix Tools (was: deleting texts between patterns)

2006-05-12 Thread Dan Sommers
On Fri, 12 May 2006 07:29:54 -0500,
Tim Chase [EMAIL PROTECTED] wrote:

 I wish to delete lines that are in between 'abc' and
 'xyz' and print the rest of the lines. Which is the best
 way to do it?

 While this *is* the python list, you don't specify whether
 this is the end goal, or whether it's part of a larger
 program. If it *is* the end goal (namely, you just want the
 filtered output someplace), and you're not adverse to using
 other tools, you can do something like

   sed -n -e'1,/abc/p' -e'/xyz/,$p' file.txt

Or even

awk '/abc/,/xyz/' file.txt

Excluding the abc and xyz lines is left as an exercise to the
interested reader.

Regards,
Dan

-- 
Dan Sommers
http://www.tombstonezero.net/dan/
I wish people would die in alphabetical order. -- My wife, the genealogist
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] Unix Tools (was: deleting texts between patterns)

2006-05-12 Thread Edward Elliott
Dan Sommers wrote:
 Or even
 
 awk '/abc/,/xyz/' file.txt
 
 Excluding the abc and xyz lines is left as an exercise to the
 interested reader.

Once again, us completely disinterested readers get the short end of the
stick. :)

-- 
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
-- 
http://mail.python.org/mailman/listinfo/python-list