Sponsored Content
Top Forums Shell Programming and Scripting use information from file for command Post 19188 by Jimbo on Sunday 7th of April 2002 09:59:39 AM
Old 04-07-2002
Sorry, I do not know what you mean by PFILES. But if you have data in a file (or piped output from a command) that you want to process on a line-by-line basis, you can use the for command. If the data to process is only the PIDs and nothing else, then:
Code:
for PID in `cat myPIDfile`
   do
   echo "Processing $PID ..."
   done

Or if you did ps -f -ujdoe > jdoe.PIDs and you now want to process that file, you could do:
Code:
for PID in `awk 'BEGIN {getline} {print $2}' jdoe.PIDs`
   do
   echo "Processing $PID ..."
   done

awk bypasses the ps header line, then outputs word 2 for each line, and this list of words is processed by the for command. To give a very simply example of the for command:
Code:
for word in This is a test of the for command.
   do
   echo $word
   done

Jimbo
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

command to know the bit information of OS

How to know the bit information of different OS, since "isainfo -kv" shows the bit information of solaris. It would be helpful, if there is some comand to know the above. Thanks, Alok (5 Replies)
Discussion started by: alokjyotibal
5 Replies

2. Solaris

command to retrieve user information

Hi, I want the command to retrieve the existing user information such as * authorization * Profile * role * exipre(expiration date of login) * inactive please tell me how to do that Thank you. (3 Replies)
Discussion started by: S_venkatesh
3 Replies

3. Solaris

Command to List Hard Disk Information

I have a SparcStation5 that is making sounds that make me think the disk drive(s) may be on the verge of quiting. What is the command to list the disk types and sizes? I'm thinking I can possibly pick up another drive or two and compy the exisiting drives while they are still working. (1 Reply)
Discussion started by: muletrainman
1 Replies

4. Shell Programming and Scripting

How to get the information about cpu idle from top command?

I am using Ubuntu 9.04. I want to write a shell script to get the information about cpu idle from top command at the real time when i call it, compare cpu idle with 20 (20%), if cpu idle > 20 exit 1, vice versa exit 0. Anybody can help me to resolve it ? Thanks alot. (7 Replies)
Discussion started by: huyquocnguyen
7 Replies

5. Solaris

command to get cluster information

hi , i have to get the cluster information , with using solaris command . thanks, ravi . (1 Reply)
Discussion started by: shankr3
1 Replies

6. Solaris

Last command displays wrong information

Hi am having Solaris10 - Sun-Fire-V890 server, the information displayed by Last command is wrong how do i get this sorted without loosing any datas.. # uptime 12:32am up 20 day(s), 33 min(s), 1 user, load average: 1.54, 1.82, 1.93 # last reboot reboot system boot Sat... (9 Replies)
Discussion started by: Sojourner
9 Replies

7. Shell Programming and Scripting

get specific information from text file or command output

Hello, I would need some help, :wall: on a linux script, I am not sure how can I separate some text file, Text file contains something similar to this: share "userhome_e" "/fs1_100g/FILE58/userhome" umask=022 maxusr=4294967295 netbios=FILE58 share "bu share"... (3 Replies)
Discussion started by: nakaedu
3 Replies

8. UNIX for Dummies Questions & Answers

Command to get Vendor information on Solaris

Hello I know that prtdiag and prtconf both give the Vendor information on the first line, something like this: System Configuration: Oracle Corporation sun4u Sun Fire V240 But is there a command that would ONLY output the vendor, so therefore in this example, it would only output Oracle... (3 Replies)
Discussion started by: flagman5
3 Replies

9. Red Hat

Command to find the harddisk information

I tried to find the harddisk information using the command hdparm -i /dev/sda. But I couldn't get the info. Is there any similar command to find the harddisk serial number. (5 Replies)
Discussion started by: gsiva
5 Replies

10. UNIX for Beginners Questions & Answers

Sftp command usage information

hello how do we get detailed information of an sftp command? for example when you type help on sftp, you get the available commands and their brief descriptions. What if you want to get detailed usage information, for example when you want to know what the command line options do..? in... (5 Replies)
Discussion started by: milhan
5 Replies
PSTREE(1)							   User Commands							 PSTREE(1)

NAME
pstree - display a tree of processes SYNOPSIS
pstree [-a|--arguments] [-c|--compact] [-h|--highlight-all|-Hpid|--highlight-pid pid] [-g]--show-pgids] [-l|--long] [-n|--numeric-sort] [-p|--show-pids] [-s|--show-parents] [-u|--uid-changes] [-Z|--security-context] [-A|--ascii|-G|--vt100|-U|--unicode] [pid|user] pstree -V|--version DESCRIPTION
pstree shows running processes as a tree. The tree is rooted at either pid or init if pid is omitted. If a user name is specified, all process trees rooted at processes owned by that user are shown. pstree visually merges identical branches by putting them in square brackets and prefixing them with the repetition count, e.g. init-+-getty |-getty |-getty `-getty becomes init---4*[getty] Child threads of a process are found under the parent process and are shown with the process name in curly braces, e.g. icecast2---13*[{icecast2}] If pstree is called as pstree.x11 then it will prompt the user at the end of the line to press return and will not return until that has happened. This is useful for when pstree is run in a xterminal. OPTIONS
-a Show command line arguments. If the command line of a process is swapped out, that process is shown in parentheses. -a implicitly disables compaction for processes but not threads. -A Use ASCII characters to draw the tree. -c Disable compaction of identical subtrees. By default, subtrees are compacted whenever possible. -G Use VT100 line drawing characters. -h Highlight the current process and its ancestors. This is a no-op if the terminal doesn't support highlighting or if neither the cur- rent process nor any of its ancestors are in the subtree being shown. -H Like -h, but highlight the specified process instead. Unlike with -h, pstree fails when using -H if highlighting is not available. -g Show PGIDs. Process Group IDs are shown as decimal numbers in parentheses after each process name. -p implicitly disables com- paction. If both PIDs and PGIDs are displayed then PIDs are shown first. -l Display long lines. By default, lines are truncated to the display width or 132 if output is sent to a non-tty or if the display width is unknown. -n Sort processes with the same ancestor by PID instead of by name. (Numeric sort.) -p Show PIDs. PIDs are shown as decimal numbers in parentheses after each process name. -p implicitly disables compaction. -s Show parent processes of the specified process. -u Show uid transitions. Whenever the uid of a process differs from the uid of its parent, the new uid is shown in parentheses after the process name. -U Use UTF-8 (Unicode) line drawing characters. Under Linux 1.1-54 and above, UTF-8 mode is entered on the console with echo -e '33%8' and left with echo -e '33%@' -V Display version information. -Z (SELinux) Show security context for each process. This flag will only work if pstree is compilied with SELinux support. FILES
/proc location of the proc file system AUTHORS
Werner Almesberger <werner@almesberger.net> Craig Small <csmall@enc.com.au> BUGS
Some character sets may be incompatible with the VT100 characters. SEE ALSO
ps(1), top(1). Linux 2012-05-20 PSTREE(1)
All times are GMT -4. The time now is 05:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy