Search:  

 
 
   All ForumsHot TopicsGallery






how-to block ads


 
Forums » Tech and Talk » OS and Software » All Things Unix » Grep From (xyz) To (xyz) Everything In Middle
Search Topic:
Uniqs:
209
Share Topic:
RSS topic:
toggle:
flat / full
normal / watch
Posting:
Post a:
Post a:
(topic move) Windows and Hotlinking »
« How do you like Hardy?  
AuthorAll Replies

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
Forums » Tech and Talk » OS and Software » All Things Unix(topic move) Windows and Hotlinking »
« How do you like Hardy?  


Sunday, 12-Oct 20:00:48 Terms of Use | Privacy Policy | Hosting by www.nac.net - DSL,Hosting & Co-lo | feedback | contact
over 9 years online! © 1999-2008 dslreports.com.
page compression OFF
Most commented news this week
· [147] It's Cable TV Rate Hike Season
· [98] Wholesale Bandwidth Prices Still Dropping
· [96] Symmetrical FiOS No Longer Qualifies For Bundle Discounts
· [95] Is Comcast Cooking Up a 22Mbps/5Mbps Tier?
· [93] Time Warner's Ugly Feud With LIN TV
· [77] Half Of New iPhone Owners Came From Verizon
· [70] Supreme Court TiVo/Echostar Ruling
· [70] Microsoft: U.S. Broadband Policy 'Total Failure'
· [69] Verizon Unveils Blackberry Storm
· [64] XOHM Online In Additional Launch Markets
Most people now reading
· Hit from behind [General Questions]
· Man with 36 accounts, raids by himself [World of Warcraft]
· Extreme HD and Essentials [Verizon FIOS TV]
· [NFL] NFL Week 6 Games, 2008 [Sports Chat]
· Homeowner Says Cable Mistake Filled Kitchen With Raw Sewage [Comcast Cable TV]
· Why do mustangs sound so good? [Automotive]
· Does Boston have a free store? [General Questions]
· Safty Question about K & T wiring. Very worried... [Home Repair & Improvement]
· What's Your "Home Page"? [General Questions]
· Fake MS update letter w/attachment [Security]