![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| grep latest file based on date. | lweegp | Shell Programming and Scripting | 12 | 04-03-2009 04:10 AM |
| modifying grep to get files only within last 2 hrs | ragha81 | Shell Programming and Scripting | 3 | 01-11-2007 07:11 PM |
| modifying C file and linking back to project files | bruins2005 | UNIX for Dummies Questions & Answers | 1 | 06-23-2006 12:08 AM |
| Perl - Appending/Modifying Excel files | srinivay | Shell Programming and Scripting | 2 | 01-10-2005 06:46 AM |
| How can I ... (Modifying large ASCII files) | hviktor | UNIX for Dummies Questions & Answers | 2 | 07-20-2001 11:28 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
modifying grep to return latest files
Hi guys,
I currently use the below mwntioned grep statemen to get the timestamp of the last generated file in the directory. (ls -ltr eCustomerCME* | grep ^- | tail -1 | awk ' { print $6,$7,$8 } ') I need to modify this grep to search for files generated only within last 2 hrs. Can you pls suggest how to achieve that by modifying my grep or by some other method in my shell script. pls help me guys.. this is urgent. thanks in advance |
|
||||
|
thanks a lot for ur help, guys. Jim your command works exactly as I expected. thanks a lot.
I used this posting in the forums to subtract hours from the date http://unix.com/showthread.php?t=190...btracting+date |
|
||||
|
Command we tried using to grep ERROR from lastest 1 log files from 5 logs files available in that particular directory is:
grep ERROR 'ls -ltr | tail -1' but this command is not working.. for me its saying.. cannot open DistributeImageFilesToTarget_10_dataLocations_PhillipinesDataLocations.xml.log if i give ls -lrt for all the files in that diretory -------r-- 1 egdevbb intdev 5022 Apr 2 05:13 DistributeDataFilesToTarget_4_dataLocations_ChinaDataLocations.xml.log -------r-- 1 egdevbb intdev 1672 Apr 2 05:14 DistributeImageFilesToTarget_14_dataLocations_WHQDataLocations.xml.log -------r-- 1 egdevbb intdev 7480 Apr 2 05:15 DistributeImageFilesToTarget_60_dataLocations_IndonesiaDataLocations.xml.log -------r-- 1 egdevbb intdev 2113 Apr 2 05:34 DistributeImageFilesToTarget_8_dataLocations_MalaysiaDataLocations.xml.log -------r-- 1 egdevbb intdev 2107 Apr 2 05:39 DistributeImageFilesToTarget_10_dataLocations_PhillipinesDataLocations.xml.log |
![]() |
| Bookmarks |
| Tags |
| grep or |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|