grep in Solaris


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers grep in Solaris
# 1  
Old 11-30-2009
grep in Solaris

Hello

I am trying to grep all the processes having strings "rman" and "MRTP"
i.e
ps -ef|grep (rman and MRTP)

how can i achieve this

Thankyou
# 2  
Old 11-30-2009
Code:
ps -ef | egrep "rman|MRTP"

or
Code:
pgrep -fl "rman|MRTP"

# 3  
Old 12-01-2009
Both of them doesnt work Smilie
# 4  
Old 12-01-2009
Both of them work fine with me, running Solaris or OpenSolaris.
Code:
$ ps -ef|grep ksh | wc -l
     261
$ ps -ef|grep java | wc -l
      21
$ ps -ef|egrep "ksh|java" | wc -l
     281

Code:
$ pgrep -fl "ksh|java" | wc -l
     279

What OS are you running ?
# 5  
Old 12-01-2009
OS is Solaris 10 and Shell is csh
# 6  
Old 12-01-2009
These scripts work with ksh, csh, sh, bash and so on.

How do you conclude they don't work ?
# 7  
Old 12-01-2009
I am looking for smthng that will grep a process having both the strings....the command that u post ..gives rman OR MRTP...whereas i am looking for rman AND MRTP
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grep works on Linux but fails on Solaris

Hi, On linux i have the below command working fine. grep -o '<name>.*</name>' deploy.tmp | sed 's/\(<name>\|<\/name>\)//g' deploy.tmp But the same is failing on Solaris uname -a SunOS mymac 5.10 Generic_150400-23 sun4v sparc sun4v Can you tell me how can i get it work on Solaris ?... (6 Replies)
Discussion started by: mohtashims
6 Replies

2. Solaris

Need grep package with -A option for Solaris 10

Hi Guys, I need grep package with -A option for Solaris 10, Where can I download this from, Please advise. (2 Replies)
Discussion started by: manalisharmabe
2 Replies

3. Shell Programming and Scripting

Grep to display file name along with content in Solaris

Am using the following grep to match a particular patter in grep. grep xyz abc.txt now while i run this command, if the pattern matched, am getting the line containing xyz Output: xyz is doing some work Now if i want the file name also along with my output, what should i do Expected... (2 Replies)
Discussion started by: rituparna_gupta
2 Replies

4. UNIX for Dummies Questions & Answers

grep issue (Solaris)

Can anyone explain this (i.e. why the 2nd grep does not find anything)?: -bash-3.00$ cat tmp.log sftp> chdir /home/test-dir sftp> mget thosefiles*.txt File "/home/test-dir/thosefiles*.txt" not found. -bash-3.00$ grep "s*.txt" tmp.log sftp> mget thosefiles*.txt File... (4 Replies)
Discussion started by: dhebden
4 Replies

5. Solaris

grep options in solaris

Hi, I am interested in knowing the grep optiojs availabel in solaris box, to get the grep results in one line from the log files. only the matched values need to be displayed. I need ot find the values in a message where the search values will be in separate lines of the input. like:... (10 Replies)
Discussion started by: sudha143
10 Replies

6. Shell Programming and Scripting

grep -o does not work in Solaris

I am using the code below to grep through a list of files (TEMPFILE) and look for rsync, rdist, rsh, ftp, etc. in each file. Do a count of each, and output that to a logfile. This works great in Linux, but not at all in Solaris because the EGREP -o option does not exist. Anyone have an idea... (5 Replies)
Discussion started by: nitrobass24
5 Replies

7. Shell Programming and Scripting

Help on Grep in solaris

Hi all, I had a script which is running in HP Unix machine. Now we are migrating to Solaris i need to run the same script which is giving me errors . grep -iqf $PATTERN output.log grep -vif $PATTERN2 output2.log when i execute these in Solaris its giving me unknown option -q -f could... (7 Replies)
Discussion started by: firestar
7 Replies

8. UNIX for Dummies Questions & Answers

How to grep word + next line in solaris 10?

Hi my unix friends, How do I grep a word and next line with solaris 10. tnx Mehrdad ---------- Post updated at 03:17 PM ---------- Previous update was at 03:09 PM ---------- I found this one: cat <file_name> | awk '/<seek_word>/ {print;getline;print}' (3 Replies)
Discussion started by: mehrdad68
3 Replies

9. Solaris

grep -e doesn't work on solaris

grep -e doesn't work in Soalris. Same script with grep -e worked on AIX/HP/LINUX.. I would like to search a list of patterns on "log.txt" like ... grep -e FATAL -e ERROR log.txt I get the error message as grep: illegal option -- e Usage: grep -hblcnsviw pattern file . . . (3 Replies)
Discussion started by: jmkraja
3 Replies

10. UNIX for Dummies Questions & Answers

problems with grep on solaris 5.8

Hi all, I have a problem when i grep for a particular field among all fhe files in the directory. if i do an ls -l field * i can find it. however at the moment the number of files in the directory are close to 28000 and it returns an ksh: /usr/bin/grep: arg list too long Assuming i... (2 Replies)
Discussion started by: manualvin
2 Replies
Login or Register to Ask a Question