LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris and OpenSolaris.
General Sun, SunOS and Sparc related questions also go here.

Notices

Reply
 
Search this Thread
Old 02-27-2007, 04:05 AM   #1
farkus888
Member
 
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, 12:21 PM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,523

Rep: Reputation: 365Reputation: 365Reputation: 365Reputation: 365
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, 05:02 PM   #3
mdhmi
Member
 
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, 07:26 PM   #4
farkus888
Member
 
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 07:28 PM.
 
  


Reply


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 08:33 AM
Can you parse text with regex? raypen Slackware 4 03-21-2006 01:26 PM
text manipulation in scripts manicman Linux - Newbie 8 02-17-2006 06:04 AM
Manipulation of text files in C++ Hady Programming 5 05-31-2005 09:24 AM
More text manipulation ice_hockey Linux - General 2 05-28-2005 02:43 AM


All times are GMT -5. The time now is 11:15 PM.

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