Date of file | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Date of file

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 01-25-2013
Manueldo Manueldo is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 25 January 2013, 4:24 PM EST
Posts: 21
Thanks: 2
Thanked 0 Times in 0 Posts
Date of file

I need to check whether my file is up to date or no...Can you tell me command in shell which helps to do it??? With example please.
Sponsored Links
    #2  
Old 01-25-2013
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 27 August 2014, 1:31 PM EDT
Location: Saskatchewan
Posts: 19,264
Thanks: 773
Thanked 3,233 Times in 3,031 Posts
What do you mean by 'up to date'? Modified today?
Sponsored Links
    #3  
Old 01-25-2013
Manueldo Manueldo is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 25 January 2013, 4:24 PM EST
Posts: 21
Thanks: 2
Thanked 0 Times in 0 Posts
NEWER...with IF test ...I guess yes.....
    #4  
Old 01-25-2013
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 27 August 2014, 1:31 PM EDT
Location: Saskatchewan
Posts: 19,264
Thanks: 773
Thanked 3,233 Times in 3,031 Posts
Newer than what?
Sponsored Links
    #5  
Old 01-25-2013
Yoda's Avatar
Yoda Yoda is offline Forum Advisor  
Jedi Master
 
Join Date: Jan 2012
Last Activity: 27 August 2014, 2:52 PM EDT
Location: Galactic Empire
Posts: 3,362
Thanks: 230
Thanked 1,197 Times in 1,125 Posts
Have a look at this page for the complete list of test-expression used with if

Code:
[[ -N filename ]] && echo yes || echo no

-N option - True if FILE exists and has been modified since it was last read. I guess this is what you are looking for!
Sponsored Links
    #6  
Old 01-25-2013
Manueldo Manueldo is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 25 January 2013, 4:24 PM EST
Posts: 21
Thanks: 2
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by bipinajith View Post
Have a look at this page for the complete list of test-expression used with if

Code:
[[ -N filename ]] && echo yes || echo no

-N option - True if FILE exists and has been modified since it was last read. I guess this is what you are looking for!
#!/bin/sh
It does not work. It gives me only NO. $3 $4$5$6 my files
file=$1
target=$2
while read line
do
if [ "$line" != "" ]
then
set $line
if [ "$1" = "$target" ]
then
if [ "$2" = ":" ]
then
for i in $3 $4 $5 $6
do
-N i && echo yes || echo no
done
fi
fi
fi
done< $file

---------- Post updated at 01:19 PM ---------- Previous update was at 01:15 PM ----------

I found out whats wrong thank you for helping
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
finding date numeral from file and check the validity of date format manas_ranjan Shell Programming and Scripting 10 11-18-2011 02:58 PM
ksh compare dates INSIDE a file (ie date A is > date B) right_coaster Shell Programming and Scripting 4 10-13-2011 11:53 PM
Delete a row from a file if one column containing a date is greater than the current system date chumsky UNIX for Dummies Questions & Answers 4 07-06-2011 02:07 AM
finding the previous day date and creating a file with date apple2685 Shell Programming and Scripting 4 05-17-2011 05:21 AM
Move A File With Same Date,don't Change The Desitination Dir Date jee.ku2 UNIX for Dummies Questions & Answers 1 01-09-2008 12:42 PM



All times are GMT -4. The time now is 02:58 PM.