Computing.Net > Forums > Unix > AWK or some search

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

AWK or some search

Reply to Message Icon

Name: johan
Date: April 16, 2008 at 06:54:25 Pacific
OS: Sun 8
CPU/Ram: 1
Comment:

Very big file is as below.
One message are separated by ----- in file
How I can find only my messages ( fOR example, number 9999888).

big.file
------------------------
text in many line
text
my Number 9999888
text ok
text ok
text etc
------------------------
text in many line
text
not my Number 2111212
text
text
------------------------
text in many line or one line
text start
my number 9999888
text message
text end
-----------------------
etc
-----------------------

It should be after search

------------------------
text in many line
text
my Number 9999888
text ok
text ok
text etc
------------------------
text in many line or one line
text start
my number 9999888
text message
text end
-----------------------


Thanks for help



Sponsored Link
Ads by Google

Response Number 1
Name: ghostdog
Date: April 16, 2008 at 19:17:20 Pacific
Reply:


awk 'BEGIN{RS="-+"}
/9999/{
print $0
}
' file


0

Response Number 2
Name: johan
Date: April 16, 2008 at 21:53:18 Pacific
Reply:

Thanks ghostdog,

Life is easy, if you can.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: AWK or some search

Increment a number using awk or sed www.computing.net/answers/unix/increment-a-number-using-awk-or-sed/6827.html

arithmetic using awk www.computing.net/answers/unix/arithmetic-using-awk/7325.html

Editing a file without awk or sed www.computing.net/answers/unix/editing-a-file-without-awk-or-sed/5437.html