Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.


  Search this Thread
Old 02-27-2007, 03:05 AM   #1
Registered: Oct 2006
Distribution: usually use arch
Posts: 103

Rep: Reputation: 15
text manipulation, REGEX plus the following line

I have been trying to find a way to do this for a while but I can't seem to find the right way to search to find my answer. I need to be able to search through large amounts of text and find my REGEX and then send the line containing the REGEX and the immediately following it to the a text file. I think I can figure out how to redirect the output on my own so no assistance needed there. before it comes up "grep -A1" does not seem to work, I am assuming that is because I am using an old version (solaris 5.9).
Old 02-27-2007, 11:21 AM   #2
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.3, Oracle Linux, Mint
Posts: 9,707

Rep: Reputation: 416Reputation: 416Reputation: 416Reputation: 416Reputation: 416
Actually, you are expecting a standard compliant grep to accept a GNU specific extension.

On recent Solaris releases, GNU grep is available as /usr/sfw/bin/ggrep, not sure about Solaris 9 but you certainly can download it.
Old 02-27-2007, 04:02 PM   #3
Registered: Dec 2005
Location: Detroit, Michigan
Distribution: Ubuntu
Posts: 86

Rep: Reputation: 15
What type of text manipulation are you trying to accomplish with "grep"? Nawk and Perl are your friends, remember.
Old 02-27-2007, 06:26 PM   #4
Registered: Oct 2006
Distribution: usually use arch
Posts: 103

Original Poster
Rep: Reputation: 15
unfortunately nawk and perl are not within my knowledge base. I did try to use sed but couldn't make it work and my knowledge of awk doesn't extend beyond setting a delimiter and selecting columns from a text stream. I am still pretty new to scripting and aside from 3 or 4 short emails from my boss I am completely self taught. I will put them on my to learn list though so I can use them in the future.

unfortunately where I work there is NO adding of software to our solaris machines. but luckily ggrep is on them already and it seems to do an excellent job at the task at hand. thanks for the helpful reply jlliagre.

Last edited by farkus888; 02-27-2007 at 06:28 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
need help with text manipulation pcorajr Programming 12 12-15-2006 07:33 AM
Can you parse text with regex? raypen Slackware 4 03-21-2006 12:26 PM
text manipulation in scripts manicman Linux - Newbie 8 02-17-2006 05:04 AM
Manipulation of text files in C++ Hady Programming 5 05-31-2005 08:24 AM
More text manipulation ice_hockey Linux - General 2 05-28-2005 01:43 AM > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 06:30 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration