AWK filter by column error


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting AWK filter by column error
# 1  
Old 05-29-2012
AWK filter by column error

I want to found the parent process of the current parent process.

I use the following script.
Code:
ps -ef|grep -v grep |awk $3==$PPID print {$8}

It is prompt the following error message:
Code:
awk: 0602-500 Quitting The source line is 1.

I am using AIX 6.1.

Would you tell me what wrong of the above script?

thank you very much

Last edited by Franklin52; 05-29-2012 at 03:21 AM.. Reason: Please use code tags for data and code samples
# 2  
Old 05-29-2012
Try:
Code:
ps -ef | awk -v p=$PPID '$3==p{print $8}'

# 3  
Old 05-29-2012
Franklin52
thank you very much
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Filter first column duplicates

Dear All, I really enjoy your help or suggestion for resolving an issue. Briefly, I have a file like this: a b c a d e f g h k g h x y z If the first column has the same ID, for example a, just remove it. The output should be this: f g h k g h x y z I was thinking to do it... (11 Replies)
Discussion started by: giuliangiuseppe
11 Replies

2. Shell Programming and Scripting

Filter on one column and then perform conditional calculations on another column with a Linux script

Hi, I have a file (stats.txt) with columns like in the example below. Destination IP address, timestamp, TCP packet sequence number and packet length. destIP time seqNo packetLength 1.2.3.4 0.01 123 500 1.2.3.5 0.03 44 1500 1.3.2.5 0.08 44 1500 1.2.3.4 0.44... (12 Replies)
Discussion started by: Zooma
12 Replies

3. Shell Programming and Scripting

awk to filter out lines containing unique values in a specified column

Hi, I have multiple files that each contain four columns of strings: File1: Code: 123 abc gfh 273 456 ddff jfh 837 789 ghi u4u 395 File2: Code: 123 abc dd fu 456 def 457 nd 891 384 djh 783 I want to compare the strings in Column 1 of File 1 with each other file and Print in... (3 Replies)
Discussion started by: owwow14
3 Replies

4. Shell Programming and Scripting

Problems with awk (fatal error) and paste (two variables into one column-by-column)

Hello, I have a script extracting columns of useful numbers from a data file, and manipulating the numbers with awk commands. I have problems with my script... 1. There are two lines assigning numbers to $BaseForAveraging. If I use the commented line (the first one) and let the second one... (9 Replies)
Discussion started by: vgbraymond
9 Replies

5. Shell Programming and Scripting

Filter more data in single column

Hi All, One of my source file column name RelationshipNumber. I need to filter below mentioned records in RelationshipNumber column. RelationshipNumber: S45678 D89763 Y09246579 A91234 If it is available in above mentioned column, then I need to print the entire line from my source... (2 Replies)
Discussion started by: suresh_target
2 Replies

6. Shell Programming and Scripting

Filter column using awk

Hi all: How do I use an `awk` like: awk '{print $1 "\t" $2}' input on the following input: <head>medium-n</head> nmod+ns+ns-map-n <head>future-n</head> of+n-the+ns-map-n to achieve the following desired output: medium-n nmod+ns+ns-map-n future-n of+n-the+ns-map-n (3 Replies)
Discussion started by: owwow14
3 Replies

7. Shell Programming and Scripting

awk filter based on column value (variable value)

Hi, I have a requirement to display/write the 3rd column from a file based on the value in the column 3. Ex: Data in the File (comma delimited) ID,Value,Description 1,A,Active 1,I,Inactive 2,S,Started 1,N,None 2,C,Completed 2,F,Failed I need to first get a list of all Unique IDs in... (7 Replies)
Discussion started by: kiranredz
7 Replies

8. Shell Programming and Scripting

Delete record filter by column

Dear friend, I have a file 2 files with column wise FILE_A ------------------------------ x,1,@ y,3,$ x,5,% FILE_B -------------------- x,1,@ i like to delete the all lines in FILE_A ,if first column available in FILE_B. output (in FILE_A) y,3,$ x,5,% (10 Replies)
Discussion started by: Jewel
10 Replies

9. Shell Programming and Scripting

filter out certain column from a file

Hi all, I have this file, how can i remove the ID Number and Cardholder Name from the file ?  Thanks CT (4 Replies)
Discussion started by: CamTu
4 Replies

10. Shell Programming and Scripting

filter based on column value

I have a file with colon separated values.. the sample is attached below. No of fields in each record/line is dependent on the value of field53. What I need to do is to design a special filter based on specific requirement of some match of values in particular column or combination of columns. ... (2 Replies)
Discussion started by: rraajjiibb
2 Replies
Login or Register to Ask a Question