The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM
Home Forums Register Rules & FAQ Members List Arcade 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 here. Shell Script Page.


Other UNIX.COM Threads You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
to get the timestamp of files from the files and folders in Unix kishan HP-UX 2 04-09-2008 05:20 AM
check position of end of line for some specific lines senthil_is Shell Programming and Scripting 1 11-08-2007 09:19 PM
How to check for specific process running through shell agp Shell Programming and Scripting 3 03-25-2006 02:24 AM
Check for specific files woosaah Shell Programming and Scripting 5 01-24-2006 02:37 PM
How do i check if 2 files have same timestamp? pt14 AIX 1 11-18-2005 09:54 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-16-2008
Registered User
 

Join Date: May 2008
Posts: 9
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
check timestamp on specific files

I have a health check script homed in /u/ainet/scripts
I need to check the time stamp on a file in /opt/config/log/
The file is called Backupdisk.out
I want write the same info that you get when you do a ls -l into a file

This is what I have been trying:

cd /opt/config/log/
ls -l | awk '$9 = "Backupdisk.out" {print $9," last successful "$6, $7," "$8" file size =", $5}' > /cust_use/home/ainet/scripts/allan.out

the desired out put in allan.out would be

Backupdisk.out last successful May 16 14:05 file size = 3365
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 05-16-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 2,203
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
And apart from the fact that you need to double the equals sign in the condition, does it work?
Reply With Quote
  #3 (permalink)  
Old 05-16-2008
Registered User
 

Join Date: May 2008
Posts: 9
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
I was getting the errors
awk: syntax error near line 1
awk: bailing out near line 1

but thanks to your double equals sign, it now works perfect.

Thanks,
Al
Reply With Quote
Google UNIX.COM
Reply



Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB 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 -7. The time now is 04:15 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger

Search Engine Optimization by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102