The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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
match string in a file to file in a directory Jae Shell Programming and Scripting 5 01-19-2008 01:11 AM
Getting the name of a file from a directory tdst Shell Programming and Scripting 2 07-12-2006 05:58 AM
i want to delete a file based on existing file in a directory srivsn Shell Programming and Scripting 3 04-11-2006 05:38 AM
Grabing a file from a directory geomonap Shell Programming and Scripting 1 02-01-2006 04:27 PM
Monitoring file in a directory pete_leon Shell Programming and Scripting 3 11-12-2005 02:30 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 04-01-2008
streddy streddy is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 2
How to more only the last file in the directory?

Hi ,

I am writing a script to more the last file (output file) in the specified directory.

Things have to be considered is, the output file written has the time of the file been executed. So i cant seem to more the file by just the hour as thr could be more than 1 file within the same hour.

my script:

dir=/opt/SMAW/INTP/bin

$dir/./sm_tool.sh countRows <--- this line will generate an output to read from. this is a dev script so i wont be able to modify it.

more getRows.info-`date '+%d_%m_%y_%H:%M:%S'` | grep 'SAR' | awk -F" " '$3!=0' | grep -v " versionized" >>
/export/home/rtp99/Tariff


output directory:

-rw-r--r-- 1 rtp99 dba 66249 Sep 19 2007 getRows.info-19_09_07_11:16:11
-rw-r--r-- 1 rtp99 dba 66975 Oct 2 2007 getRows.info-02_10_07_09:55:38
-rw-r--r-- 1 rtp99 dba 66975 Oct 19 17:40 getRows.info-19_10_07_17:37:06
-rw-r--r-- 1 rtp99 dba 66975 Oct 25 13:36 getRows.info-25_10_07_13:33:34
-rw-r--r-- 1 rtp99 dba 67701 Dec 5 10:53 getRows.info-05_12_07_10:50:23
-rw-r--r-- 1 rtp99 dba 67701 Jan 2 17:23 getRows.info-02_01_08_17:20:08
-rw-r--r-- 1 rtp99 dba 67701 Jan 17 10:15 getRows.info-17_01_08_10:13:00
-rw-r--r-- 1 rtp99 dba 70121 Feb 15 10:34 getRows.info-15_02_08_10:31:34
-rw-r--r-- 1 rtp99 dba 70121 Mar 14 10:22 getRows.info-14_03_08_10:19:28
-rw-r--r-- 1 rtp99 dba 70121 Mar 26 13:26 getRows.info-26_03_08_13:22:48
-rw-r--r-- 1 rtp99 dba 70121 Apr 1 00:27 getRows.info-01_04_08_00:23:27
-rw-r--r-- 1 rtp99 dba 70121 Apr 1 15:15 getRows.info-01_04_08_15:11:17

pls ur thoughts.
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:18 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0