Report running processes in a specific format (tricky column filtering)
First off I have HP Unix, so as far as I can tell the PS command does not let me list specifically which columns I would like or what order I would like to see them.
I want to make a custom PS script for checking what SAS process are running. I want it to take 1 argument of user name and only report processes for that user. I also only want to report process that start with /sas/sas_8.2/sas. What I want to report for these processes is the last argument in there command statement (the count09.sas, the program being executed by sas) along with the ProcID, STIME and TIME. I'm having trouble parsing the PS statement, for one reason, because the amount of "columns" That awk sees before the command statement varies depending on the values in each column.
Any ideas on an approach here? Awk columns has been falling short for me, and my script is still significantly lacking. Is there any way to do column management in my output script so that the titles line up with each column as well?
To explain why awk columns won't work for me take the following output:
See how postpull10rev.sas is the 13th column? but count09.sas is the 14th column? This is because STIME reads "10:02:58" in one and "FEB 13" in the other.
I've tried this previously. I get "ps: illegal option -- o". My man page says that "-o" is XPG4 Only. Several other options are labeled XPG4 only and are unusable as well.
It seems really odd to me that -o wouldn't work, because as far as I can tell, this makes the availabilty of columns like etime useless, because it doesn't come in any of the pre established lists like -l or -f, so I have no way of displaying it.
To give you a better idea of what I do and don't have available here is my usage:
I don't have root acces to this machine, but is the ps source code somewhere that I could compile it into my home directory? I haven't been able to find the source code anywhere with google, but that would make sense since ps comes with every system.
Gold Fish
I've tried this previously. I get "ps: illegal option -- o". My man page says that "-o" is XPG4 Only. Several other options are labeled XPG4 only and are unusable as well.
It seems really odd to me that -o wouldn't work, because as far as I can tell, this makes the availabilty of columns like etime useless, because it doesn't come in any of the pre established lists like -l or -f, so I have no way of displaying it.
To give you a better idea of what I do and don't have available here is my usage:
I don't have root acces to this machine, but is the ps source code somewhere that I could compile it into my home directory? I haven't been able to find the source code anywhere with google, but that would make sense since ps comes with every system.
Gold Fish
If your manual page mentions XPG4 options, it probably also mentions the full path to the XPG4 version of "ps".
If not, do a search on your disk to see if there are another other "ps" commands available.
There was no mention of a location in the man file (I read though all of it) or how to run it. I am unsure to what XPG4 is but my best guess is that it is some sort of compiler time option, which is of no help to me.
The find command yielded only one other ps command, which sadly reacts the same way as the old one and has the same options.
So for the last argument I move 66 characters forward until I have the word saswork (this works as a filter) and then grab the remaining characters. I also added a 'p' and a '-n', so that I would only get the lines of interest. In my expirements, the 'p' kept having the sed line show up as well, because "saswork" is located in that line too. Luckily saswork just happens to be 67 characters into the process name and not 66 characters, so there is a difference.
Hi,
I tried filtering the records in a csv file using "awk" command listed below.
awk -F"~" '$4 ~ /Active/{print }' inputfile > outputfile
The output always has all the entries.
The same command worked for different users from one of the forum links.
content of file I was... (3 Replies)
Hi there,
I am trying to filter a big file with several columns using values on a column with values like (AC=5;AN=10;SF=341,377,517,643,662;VRT=1). I wont to filter the data based on SF= values that are (bigger than 400)
... (25 Replies)
I have an xml file dumped from rrd file, that I want to "patch" so the xml file doesn't contain any blank hole in the resulting graph of the rrd file.
Here is the file.
<!-- 2015-10-12 14:00:00 WIB / 1444633200 --> <row><v> 4.0419731265e+07 </v><v> 4.5045912770e+06... (2 Replies)
I have a table to data which one of the columns include string of text
from within that, I am searching to include few lines but not others
for example I want to to include some combination of word address such as (address.| address? |the address | your address) but not (ip address | email... (17 Replies)
Hi,
I am currently filtering a file, "BUILD_TIMES", that has multiple column of information in it. An example of the data is as follows;
Fri Nov 5 15:31:33 2010 00:28:17 R7_BCGNOFJ_70.68
Fri Nov 5 20:57:41 2010 00:07:21 R7_ADJCEL_80.6
Wed Nov 10 17:33:21 2010 00:01:13 R7_BCTTEST3_80.1X... (7 Replies)
Hi,
I want to filter a file that contains 11 columns. Basically I want to filter based on column 7.
The file that I have looks like this:
1 3 4 AB 45 run PPPPPPPOOOOOOOLLLLLLLL... 5 9 ui
So for column 7 i want to delete lines that have a . OR more than 2 .
So if I were to... (3 Replies)
Hi,
I have the following text file:
8 T1mapping_flip02 ok 128 108 30 1 665000-000008-000001.dcm
9 T1mapping_flip05 ok 128 108 30 1 665000-000009-000001.dcm
10 T1mapping_flip10 ok 128 108 30 1 665000-000010-000001.dcm
11 T1mapping_flip15 ok 128 108 30... (2 Replies)
Hi,
I am having trouble converting a text file. I have been working for this whole day now, still i couldn't make it.
Here is how the text file looks:
_______________________________________________________
DEVICE STATUS INFORMATION FOR LOCATION 1:
OPER STATES: Disabled E:Enabled ... (5 Replies)
Hi all,
I would like to extract records of a file based on a condition. The file contains 47 fields, and I would like to extract only those records that match a certain value in one of the columns, e.g.
COL1 COL2 COL3 ............... COL47
1 XX 45 ... (4 Replies)