Sponsored Content
Top Forums Shell Programming and Scripting MEM=`ps v $PPID| grep -i db2 | grep -v grep| awk '{ if ( $7 ~ " " ) { print 0 } else Post 302237604 by hariza on Thursday 18th of September 2008 02:29:22 AM
Old 09-18-2008
hi ,

Thanks for your reply. For some reason still doesn't work for me. I took some parts of your command to at least get it to work using :

MEM=`ps v $PPID | grep -i db2| awk '{ if ($7 == "") print 0; else print $7; }`

and with the debug on I get the below:

MEM2=175804
+ + ps v 1790056
+ grep -i db2
+ awk { if ($7 == "") print 0; else print $7; }
MEM=
+ print

so you can see that the variable MEM suppose to be set to 0 but is not. Thanks again and thanks for your sugesstions. It take a while to come with a good coding techniques. Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Print The ouput From ls | grep "!!!"

guys forget the find command coz with find command u can't get condational output like grep. I will give small example :- Apr 10 09:12 aacbl222_12aug1998.lqc Apr 10 09:12 sscbl4534_4sep2001.lqc Apr 10 09:12 ah66fmi_5jan1997.lqc Apr 10 09:12 y313h1_7sep1998.lqc May 11 09:12... (5 Replies)
Discussion started by: geoquest
5 Replies

2. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

3. Shell Programming and Scripting

ls -laR | grep "^-" | awk '{print $9}'| grep "$.txt"

Hi, I don't know hot to make this command work: ls -laR | grep "^-" | awk '{print $9}'| grep "$.txt" It should return the list of file .txt It's important to search .txt at the end of the line, becouse some file name have "txt" in their name but have other extensions (13 Replies)
Discussion started by: DNAx86
13 Replies

4. Shell Programming and Scripting

grep '\~' b | awk '{print $1","$3}' | sed -e 's/~//g'

Hi all, grep '\~' b | awk '{print $1","$3}' | sed -e 's/~//g' Iam using above command for some report... can this be done using any one of them either sed or awk or grep... (3 Replies)
Discussion started by: harshakusam
3 Replies

5. Shell Programming and Scripting

ps -ef | grep "string1" "string2" " "string3"

Hi all, can any one suggest me the script to grep multiple strings from ps -ef pls correct the below script . its not working/ i want to print OK if all the below process are running in my solaris system. else i want to print NOT OK. bash-3.00$ ps -ef | grep blu lscpusr 48 42 ... (11 Replies)
Discussion started by: steve2216
11 Replies

6. Shell Programming and Scripting

grep with "[" and "]" and "dot" within the search string

Hello. Following recommendations for one of my threads, this is working perfectly : #!/bin/bash CNT=$( grep -c -e "some text 1" -e "some text 2" -e "some text 3" "/tmp/log_file.txt" ) Now I need a grep success for some thing like : #!/bin/bash CNT=$( grep -c -e "some text_1... (4 Replies)
Discussion started by: jcdole
4 Replies

7. Shell Programming and Scripting

regex, awk, grep question "how to"

I've been working on this for 2 days and I'm not getting far. It is time to turn to you guys. With the data below, I am trying to create a file that looks like this: I'd like to use some form of egrep I think. AY#box#P04prod_to_contingency s AY#cmd#P04dump_cont_db s AY#cmd#P04get_on_ice_job s... (2 Replies)
Discussion started by: rawbi01
2 Replies

8. Shell Programming and Scripting

Pick first "code" only [ grep/awk ]

All I have a requirement to search and pick the data as below. Explained with example. 38999|4812 Highway 52 North|Rockville|55901|0196 67541|2800 Dexter Road|Northville|38999|0196 This is pipe separate data. First column represents dealer id and 4th column represents the zip code where... (4 Replies)
Discussion started by: ak835
4 Replies

9. Shell Programming and Scripting

Cmd="grep 'Name:' |awk -F' ' '{print $2}'"

Hi Is it possible to get the below code working.? cmd="grep 'Name:' |awk -F' ' '{print $2}'|xargs -i basename {}" echo $cmd ( rman target / <<EOF1 LIST COPY ; exit EOF1 ) | `$cmd` in nutshell I want to be able to preset cmd as depending on script flow it can be... (2 Replies)
Discussion started by: zam
2 Replies

10. UNIX for Beginners Questions & Answers

How to print the "grep" result as specified keyword order?

I have a content.xls file as given below, NC_020815.1 1891831 1894692 virb4_A0A0H2X8Z4_ 1 954 1945 NC_020815.1 1883937 1886123 vird4_A0A0P9KA26_ 1 729 1379 NC_020815.1 2976151 2974985 virb10_H8FLU5_Ba 1 393 478 NC_020815.1 2968797 2967745 virb6_A0A0Q5GCZ4 5 398 499... (2 Replies)
Discussion started by: dineshkumarsrk
2 Replies
MEM(4)							     Linux Programmer's Manual							    MEM(4)

NAME
mem, kmem, port - system memory, kernel memory and system ports DESCRIPTION
mem is a character device file that is an image of the main memory of the computer. It may be used, for example, to examine (and even patch) the system. Byte addresses in mem are interpreted as physical memory addresses. References to nonexistent locations cause errors to be returned. Examining and patching is likely to lead to unexpected results when read-only or write-only bits are present. It is typically created by: mknod -m 660 /dev/mem c 1 1 chown root:kmem /dev/mem The file kmem is the same as mem, except that the kernel virtual memory rather than physical memory is accessed. It is typically created by: mknod -m 640 /dev/kmem c 1 2 chown root:kmem /dev/kmem port is similar to mem, but the I/O ports are accessed. It is typically created by: mknod -m 660 /dev/port c 1 4 chown root:mem /dev/port FILES
/dev/mem /dev/kmem /dev/port SEE ALSO
chown(1), mknod(1), ioperm(2) COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 1992-11-21 MEM(4)
All times are GMT -4. The time now is 07:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy