Find Processes that were not started today


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Find Processes that were not started today
# 1  
Old 05-04-2012
Find Processes that were not started today

Hi all I'm trying to find a one line command that would show me all columns of the ps -ef command for all the processes started by our id that weren't started today, so where column 5 is non-numeric. I get the results I need by running three commands but was wondering if there is a way to print these with a one-line command.

First command ( prints all processes started by testid and sorts by the time column and stores in test1.txt)
Code:
ps -ef | grep testid | sort -k5 > test1.txt

Second command ( prints the 5th column only for all processes started by testid and sorts by the time column and stores in test2.txt)
Code:
ps -ef | grep testid | sort -k5 | awk '{print $5}' | grep -v [0123456789] > test2.txt

Third command ( grep test1.txt for the lines in test2.txt)
Code:
grep -f test2.txt test1.txt

I'm thinking there is a way to do this all in one command but can't figure it out

Last edited by Scrutinizer; 05-14-2012 at 06:09 PM.. Reason: code tags
# 2  
Old 05-04-2012
Hi,

You would need this:
Code:
ps -ef | grep -v PID | awk '$5 !~ /[0123456789]/ { print }'

# 3  
Old 05-04-2012
Slightly modified:
Code:
ps -ef | awk '$5 !~ /^[0-9]/ &&  $5 !~ /STIME/'

-or-
Code:
ps -ef | awk '$5 ~ /^[A-Z]/ && $5 !~ /STIME/'


Last edited by 47shailesh; 05-04-2012 at 05:09 PM.. Reason: removed print
# 4  
Old 05-14-2012
thanks that worked
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Find and copy .zip file based on today's date

Hi Team, I'm new to unix and i have a requirement to copy or move files from one directory to another based on current date mentioned in the .zip file name. Note that i need to copy only the recent zip file. please help me with the code i tried the code as: #! /usr/bin/sh find... (3 Replies)
Discussion started by: midhun3108
3 Replies

2. Shell Programming and Scripting

Find files from only today

This finds files from yesterday and today. I need it to find only files from today. sudo find /home/andy -iname "*.sh" -mtime -1 -print (8 Replies)
Discussion started by: drew77
8 Replies

3. Programming

JVM processes are not getting memory allocation as soon as started

Hi, i have this scenario, when i start about 20 java processes simultaneously in unix and run ps -eaf command i can see that processes are running but memory is not getting allocated to them immediately and it stays ideal for at least 10-15 min. Meanwhile i run free command to check the RAM,... (5 Replies)
Discussion started by: Vishal Gangrade
5 Replies

4. Shell Programming and Scripting

Error when connecting to remote server to find files with timestamp today's day

I am connecting to remote server and try to check if files with timestamp as Today's day are on the directory. Below is my code TARFILE=${NAME}.tar TARGZFILE=${NAME}.tar.gz ssh ${DESTSERVNAME} 'cd /export/home/iciprod/download/let/monthly; Today=`date +%Y%m%d`; if ;then echo "We... (1 Reply)
Discussion started by: digioleg54
1 Replies

5. Shell Programming and Scripting

Find and awk with today's date

Hi All, Solaris 10 o/s With your help I developed the following script. find /oracle/diag/rdbms/*/*/trace -type f -name '*d00*.trc' -mtime 0 -exec egrep –c 'NS Primary Error' '{}' '+' which returns the counts I needed nelow: /oracle/diag/rdbms/musidp/musidp/trace/abcdef_d001_21751.trc:15... (9 Replies)
Discussion started by: bdby
9 Replies

6. What is on Your Mind?

School Semester Started Today...

So, after two years of quitting school (huge mistake), I started back up today working towards a Database Administration Associates Degree. I'm taking an Introduction to UNIX/Linux course which should be.....pretty easy. Even though I'm a complete noob in comparison to a lot of you, I do some... (3 Replies)
Discussion started by: phunk
3 Replies

7. Shell Programming and Scripting

Find file that matches today's date in filename and move to /tmp in bash

I'm having problems with my bash script. I would like to find a file matching today's date in the filename, i.e. my_file_20120902.txt and then move it to a different directory, i.e. /tmp. Thanks. (1 Reply)
Discussion started by: jamesi
1 Replies

8. Shell Programming and Scripting

How to find files created today in a particular directory?

Dear All, I want a Hp Ux command to find out the files created today in a particular directory or mountpoint. Kindly help. Thanks Bhaskar (10 Replies)
Discussion started by: sudiptabhaskar
10 Replies

9. Shell Programming and Scripting

Find files older then today & display with timestamp info

Small query- I want to do some operation on all the files older then today. Before I do that operation, i want to verify if the command works properly or not. Surprisingly, the command below returns me file, which are created today - find /mrk_archive/PG/ftp/incomming/gbs/2008 -type f... (2 Replies)
Discussion started by: kedar.mehta
2 Replies

10. Shell Programming and Scripting

how to find today's files & send to another server?

Hi All, My script has to find todays modified( less than 24 hrs) files & send it another server using SCP. what I wrote is find . -type f -mtime -1 | xargs ls -ltr ## to find today's files, but its giving my sh_history file also, I don't require this file at all. scp... (4 Replies)
Discussion started by: zinu
4 Replies
Login or Register to Ask a Question