Sponsored Content
Full Discussion: Grep files older than 1 day
Top Forums Shell Programming and Scripting Grep files older than 1 day Post 302869151 by Daniel Gate on Tuesday 29th of October 2013 04:44:23 PM
Old 10-29-2013
Code:
# ps -o etime,pid,user,args -e | awk '$1 ~ /[0-9]+\-/' |grep pio
19-08:53:21 12517408   d_prod /usr/lib/lpd/pio/etc/piohpnpf -x iphb-3h25-ps2 -p 9100 
12-19:37:39 24051782   d_prod /usr/lib/lpd/pio/etc/piohpnpf -x 10.5.3.38 -p 9100 
 7-06:06:23 44630260   d_prod /usr/lib/lpd/pio/etc/piohpnpf -x stt-t6s22-ps1 -p 9100 
14-20:19:45 11665916   d_prod /usr/lib/lpd/pio/etc/piohpnpf -x 10.3.4.18 -p 9100 
 4-06:34:30 16908752   d_prod /usr/lib/lpd/pio/etc/piohpnpf -x umhs-5picu-ps1 -p 9100 
 9-06:08:08 21561844   d_prod /usr/lib/lpd/piobe -d s /var/spool/qdaemon/t--g3aa 
 2-06:39:09 40436142   d_prod /usr/lib/lpd/pio/etc/pioout -A0 -B34448 -C14688 -F\14\15 
14-08:43:36 42598762   d_prod /usr/lib/lpd/pio/etc/piohpnpf -x 10.5.3.38 -p 9100 
 6-06:31:22 44499334   d_prod /usr/lib/lpd/pio/etc/piohpnpf -x umhn-10w52a-ps1 -p 9100 
10-06:32:53 55509354   d_prod /usr/lib/lpd/pio/etc/piohpnpf -x umhn-10w52a-ps1 -p 9100 
 5-15:40:17 58982670   d_prod /usr/lib/lpd/pio/etc/pioout -A0 -B43588 -C14688 -F\14\15 
 9-06:35:59  6488798   d_prod /usr/lib/lpd/pio/etc/piohpnpf -x umhs-5picu-ps1 -p 9100

The date and time looks confusing. Is there a way to make human-readable?

Please advise.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Deleting / finding files older than X days missess a day

Hi When trying to find and delete files which are, say, 1 day, the find command misses a day. Please refer the following example. xxxd$ find . -type f -ctime +1 -exec ls -ltr {} \; total 64 -rw-rw-r-- 1 oracle xxxd 81 Apr 30 11:25 ./ful_cfg_tmp_20080429_7.dat -rw-rw-r-- 1... (4 Replies)
Discussion started by: guruparan18
4 Replies

2. Shell Programming and Scripting

Listing processes that are a day older

Hi All, I am trying to automate some stuff to make my 'to-do-things' easier. I am in need for help regarding this. I have an output root 17187 3465 0 23:00:00 ? 0:01 Process1 root 4975 4974 0 May 12 ? 0:00 Process2 root 4042 16713 0 Jan 30 pts/22 0:00... (4 Replies)
Discussion started by: reddybs
4 Replies

3. Shell Programming and Scripting

Find the number of files older than 1 day from a dir

Hello All, I need to write a script/command which can find out the number of .csv files residing in a directory older than 1 day. The output should come with datewise (means for each date how many files are there). I've this command, but this command gives the total number of files. It's... (10 Replies)
Discussion started by: NARESH1302
10 Replies

4. Shell Programming and Scripting

how to delete the older files other than the recently added 5 files

Number of files will get created in a folder automatically daily.. so i hav to delete the older files other than the recently added 5 files.. Could u help me through this..?? (5 Replies)
Discussion started by: shaal89
5 Replies

5. UNIX for Dummies Questions & Answers

Move the files between Current day & a previous day

Hi All, I have a requirement where I need to first capture the current day & move all the files from a particular directory based on a previous day. i.e move all the files from one directory to another based on current day & a previous day. Here is what I am trying, but it gives me errors.... (2 Replies)
Discussion started by: dsfreddie
2 Replies

6. Shell Programming and Scripting

How archive the older than 30 day files to another unix server

I need to archive the older than 30 day file to another uinx server.I have wrote the below uinx script. for LOOK_DIR in /TempFiles do for FILE in `find ${LOOK_DIR} -mtime -30 -exec ls {} \;` do echo ${FILE} >> file_list ## This file will have the list of files copied and... (12 Replies)
Discussion started by: murari83.ds
12 Replies

7. Shell Programming and Scripting

Sftp - 1 day older files count

Need to write a shell script on AIX box which will connect to different servers using SFTP and get the file count of only 1 day older files. (purging list) How to achieve this? On local server we can use: find <path> -type f -mtime +1 But how to do it in case of SFTP? Please advise. Thanks... (9 Replies)
Discussion started by: vegasluxor
9 Replies

8. Shell Programming and Scripting

How to create zip/gz/tar files for if the files are older than particular days in UNIX or Linux?

I need a script file for backup (zip or tar or gz) of old log files in our unix server (causing the space problem). Could you please help me to create the zip or gz files for each log files in current directory and sub-directories also? I found one command which is to create gz file for the... (4 Replies)
Discussion started by: Mallikgm
4 Replies

9. Shell Programming and Scripting

Find processes older than 1 day

// AIX 6.1 I need to extract PIDs of ps -ef |grep /usr/lib/lpd/pio | awk '{print $2}' ps -ef |grep qdaemon |grep /usr/bin/ksh | awk '{print $2}' that are older than 1 day. I know find . -type f -mtime +1, but it doesn't work for PIDs. Please let me know how to get the PIDs older than... (1 Reply)
Discussion started by: Daniel Gate
1 Replies

10. Shell Programming and Scripting

Delete all log files older than 10 day and whose first string of the first line is "MSH" or "<?xml"

Dear Ladies & Gents, I have a requirement to delete all the log files in /var/log/test directory that are older than 10 days and their first line begin with "MSH" or "<?xml" or "FHS". I've put together the following BASH script, but it's erroring out: for filename in $(find /var/log/test... (2 Replies)
Discussion started by: Hiroshi
2 Replies
ZGREP(1)                                                      General Commands Manual                                                     ZGREP(1)

NAME
zgrep - search possibly compressed files for a regular expression SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code: (-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If the GREP environment variable is set, zgrep uses it as the grep program to be invoked. EXIT CODE
2 - An option that is not supported was specified. AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1) ZGREP(1)
All times are GMT -4. The time now is 11:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy