PID length


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting PID length
# 8  
Old 12-20-2007
Code:
ps -ef | grep "bin/Alime" | grep -v grep | awk '{print $2}'

# 9  
Old 12-20-2007
# 10  
Old 12-20-2007
Code:
ps -ef | awk '/bin\/Alime/{print $2}'

# 11  
Old 12-20-2007
Quote:
Originally Posted by ghostdog74
Code:
ps -ef | awk '/bin\/Alime/{print $2}'

yep, no need to all the greppin' brouhaha
# 12  
Old 12-20-2007
I have found this PID_MAX:

(./usr/sys/include/sys/limits.h)
Code:
#define PID_MAX              INT_MAX         /* max value for process ID */

and INT_MAX is defined as:
(./arch/alpha/machlimits.h)
Code:
#define       INT_MAX          2147483647     /* max value for an int */

2147483647 --> 10 characters

Thank you very much to all of you for your time

Oops ! The awk option is much better ! thanks again !!
# 13  
Old 01-18-2008
Bug This might also work

ps -ef | grep your_process | grep -v grep | tr -s " " | cut -f2
# 14  
Old 01-18-2008
Quote:
Originally Posted by Rajesh Kumar
ps -ef | grep your_process | grep -v grep | tr -s " " | cut -f2
probably doesn't matter. to reduce redundant use of grep -v grep, you could use awk
Code:
ps -ef | awk '/process/{print $2}'

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Flat file-make field length equal to header length

Hello Everyone, I am stuck with one issue while working on abstract flat file which i have to use as input and load data to table. Input Data- ------ ------------------------ ---- ----------------- WFI001 Xxxxxx Control Work Item A Number of Records ------ ------------------------... (5 Replies)
Discussion started by: sonali.s.more
5 Replies

2. Shell Programming and Scripting

changing a variable length text to a fixed length

Hi, Can anyone help with a effective solution ? I need to change a variable length text field (between 1 - 18 characters) to a fixed length text of 18 characters with the unused portion, at the end, filled with spaces. The text field is actually field 10 of a .csv file however I could cut... (7 Replies)
Discussion started by: dc18
7 Replies

3. Shell Programming and Scripting

Make variable length record a fixed length

Very, very new to unix scripting and have a unique situation. I have a file of records that contain 3 records types: (H)eader Records (D)etail Records (T)railer Records The Detail records are 82 bytes in length which is perfect. The Header and Trailer records sometimes are 82 bytes in... (3 Replies)
Discussion started by: jclanc8
3 Replies

4. UNIX for Dummies Questions & Answers

What the command to find out the record length of a fixed length file?

I want to find out the record length of a fixed length file? I forgot the command. Any body know? (9 Replies)
Discussion started by: tranq01
9 Replies

5. UNIX for Dummies Questions & Answers

Need to get pid of a process and have to store the pid in a variable

Hi, I need to get the pid of a process and have to store the pid in a variable and i want to use this value(pid) of the variable for some process. Please can anyone tell me how to get the pid of a process and store it in a variable. please help me on this. Thanks in advance, Amudha (7 Replies)
Discussion started by: samudha
7 Replies

6. UNIX for Dummies Questions & Answers

Session PID & socket connection pid

1. If I use an software application(which connects to the database in the server) in my local pc, how many PID should be registered? Would there be PID for the session and another PID for socket connection? 2. I noticed (through netstat) that when I logged in using the my software application,... (1 Reply)
Discussion started by: pcx26
1 Replies

7. UNIX for Dummies Questions & Answers

Sed working on lines of small length and not large length

Hi , I have a peculiar case, where my sed command is working on a file which contains lines of small length. sed "s/XYZ:1/XYZ:3/g" abc.txt > xyz.txt when abc.txt contains lines of small length(currently around 80 chars) , this sed command is working fine. when abc.txt contains lines of... (3 Replies)
Discussion started by: thanuman
3 Replies

8. Programming

printing ppid,child pid,pid

question: for the below program i just printed the value for pid, child pid and parent pid why does it give me 6 values? i assume ppid is 28086 but can't figure out why there are 5 values printed instead of just two! can someone comment on that! #include<stdio.h> #define DIM 8 int... (3 Replies)
Discussion started by: a25khan
3 Replies

9. Shell Programming and Scripting

creating a fixed length output from a variable length input

Is there a command that sets a variable length? I have a input of a variable length field but my output for that field needs to be set to 32 char. Is there such a command? I am on a sun box running ksh Thanks (2 Replies)
Discussion started by: r1500
2 Replies
Login or Register to Ask a Question