 utahluge
join:2004-10-14 Draper, UT
·MSTAR
·On-Digital / JustR..
| Grep From (xyz) To (xyz) Everything In Middle
I am trying to grep for (xyz) and get everything till the next (xyz). Right now I am using -Bx and -Ax but sometimes the number of lines varies. Is there a way to do this? I am rotating through each set in a script and grabbing info from each set. Is grep the right tool or is there another tool that will do what I would like? Thanks!! |
|
  jdong Eat A Beaver, Save A Tree. Premium join:2002-07-09 Rochester, MI clubs:   | Maybe use perl and split() by "(xyz)" as the token? Otherwise you'd probably want to use regex and sed or awk or perl, not grep. -- Ubuntu MOTU Developer and Forums Council |
|
  evilghost Premium join:2003-11-22 Springville, AL | reply to utahluge What about egrep/grep with a regexp since it sounds like you want everything between all instances of (xyz). |
|
  Cabal Premium join:2007-01-21 Boston, MA | reply to utahluge 
Not Perl. |
|
 pablo2525
join:2003-06-23
edit: May 19th, @09:22PM
| reply to utahluge Seems like `sed' is what you want:
Tweak to suit your taste.
-- pablo openSUSE 10.3/KDE ISP: TekSavvy DSL; backhauled via a 6KM wireless link |
|