LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 02-27-2007, 03: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, 11:21 AM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
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
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, 06: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 06:28 PM.
 
  


Reply



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

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 03:43 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
Open Source Consulting | Domain Registration