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
Manipulation of Date in Shell jnanesh.b Shell Programming and Scripting 1 01-11-2008 01:16 PM
Date Manipulation mgirinath Shell Programming and Scripting 6 04-03-2007 05:25 AM
Help with log manipulation StevePace Shell Programming and Scripting 3 01-31-2006 08:28 PM
date manipulation jalburger Shell Programming and Scripting 3 05-10-2004 02:09 PM
Time/date manipulation choice High Level Programming 1 02-01-2002 04:06 PM

Closed Thread
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
  #1 (permalink)  
Old 04-01-2008
pstanand pstanand is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 10
date manipulation

HI,
I'm comparing my file date with the system date and if both the dates are equal I'm doing some operation. I use two variables for these two dates. I use the following command in my query. if [ $cd=$fdate]....
But here the current date $cd shows 01 and filedate $fdate shows 1. The file is created on 1 of the month. Because of this the condition is not matching and goes to else part of my pgm. Why it is showing filedate as 1 while listing? How to manipulate this? Kindly let me know.

Thanks in advance.

pstanand
  #2 (permalink)  
Old 04-01-2008
fpmurphy's Avatar
fpmurphy fpmurphy is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2003
Location: Florida
Posts: 1,945
How are you getting the date of the file i.e. filedate?
  #3 (permalink)  
Old 04-01-2008
pstanand pstanand is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 10
Date manipulation

I'm using the following command to get the file date.
fdate=`ls -l filename|awk -F" " '{print $7}'
echo $fdate


Regards
pstanand
  #4 (permalink)  
Old 04-03-2008
pstanand pstanand is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 10
date manipulation

hi buddies,

can you please let me know the solution
  #5 (permalink)  
Old 04-03-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,813

Code:
touch -t YYYYMMDDhhmmss /tmp/touchfile
find ./  ! -older /tmp/touchfile  | \
while read file
do
  # do stuff with the file here
done

where YYYYMMDDhhmmss is, say, midnight (the start of today)
  #6 (permalink)  
Old 04-03-2008
curleb curleb is offline
Registered User
  
 

Join Date: Mar 2008
Location: Here, in my Ivory Tower...
Posts: 68
under ksh you can use typeset when defining your variables...it'll level the presentation and therefore evaluation of the values:


Code:
$ cd="01"
$ fdate="1"
$ echo $cd $fdate
01 1
$ typeset -i cd="01"
$ typeset -i fdate="1"
$ echo $cd $fdate

typeset does not provide for an export, however. You'd need to do this separately...
Closed Thread

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:01 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