grep awk example script


What is this stuff?

If this isn't exactly what you wanted, please try our Search (there's a LOT of techy and non-techy stuff here about Linux, Unix, Mac OS X and just computers in general!):



From - Fri Jun 16 07:27:48 2000 Message-ID: <3945CF25.F79F60DE@idealgroup.com>
Date: Mon, 12 Jun 2000 23:05:25 -0700
From: Darryl Krasman <darryl@idealgroup.com>
Organization: Ideal Computer Group Inc.
X-Mailer: Mozilla 4.7 [en] (X11; I; SCO_SV 3.2 i386)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.unix.sco.misc
Subject: Re: Newbie grep question References: <m131cNG-000CnpC@egps.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: sparky.idealgroup.com
X-Trace: 12 Jun 2000 23:03:03 -0800, sparky.idealgroup.com
Lines: 41
Path: news.randori.com!hermes.visi.com!news-out.visi.com!upp1.onvoy!msc1.onvoy!onvoy.com!sunqbc.risq.qc.ca!cyclone.bc.net!newsfeed.bc.tac.net!news.vphos.net!sparky.idealgroup.com
Xref: news.randori.com comp.unix.sco.misc:61649
X-Mozilla-Status: 8010
X-Mozilla-Status2: 00000000


Hate these ads?



Nachman Yaakov Ziskind wrote:

> ... any easy way to sed/awk/grep out the line AFTER the marker line?
> I.e., I have text like this:

> junk
> junk
> MARK
> I want this line
> junk
> junk
> junk
> MARK
> I want this line
> junk
> junk
> MARK
> I want this line
> junk
> junk
> junk
> junk
> MARK
> I want this line
> MARK
> I want this line

> and so forth? No particular patterns/line counts to rely on - just the
> presence of "MARK" lets me know that the next line is valuable.  I spent some
> time reading man pages, and managed to hit
> MEGO. :-(

> SCO OSE 505

> Thanks!



Assuming your data is in a file called "data" try this:
$ awk '/^MARK/ { OK = 1; continue } OK == 1 { print $0; OK = 0 }' data
-- 
Darryl
Ideal Computer Group Inc.


















Comments /Bofcusm/385.html


Add your comments




Enter your email address for automatic notification of new posts here
(be sure to whitelist 'feedburner.com' if you use spam filtering)

Or use any RSS reader

Delivered by FeedBurner





Views for this page
Today This Week This Month This Year  Overall
1161011,090 3,601

/Bofcusm/385.html copyright 1997-2004 (various authors) All Rights Reserved

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Publishing your articles here

More:
       - Newsgroup




Related Posts

How do I recursively grep through sub directories?

grep and ps

Grep -d --recurse

How do I solve an "arglist too long"?

Xargs test question

Grep in Depth

Xargs test question

Wrapping scripts

Xargs


Unix/Linux Consultants

Your ad here - $24.00 yearly!

http://echo3.net/ Unix/Linux Custom Applications, Web Hosting, C/C++ Programming Courses


http://www.vss3.com SCO/Caldera OpenServer, Unixware & Linux. Tarantella & Non-stop Clustering


http://thatitguy.com Business networking servers, Linux and Unix experts. In business since 1997! Windows and Exchange to Samba and Scalix migration experts.









Change Congress


Related Posts