The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



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 !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Compare date from db2 table to yesterday's Unix system date sasaliasim Shell Programming and Scripting 9 12-01-2008 11:37 PM
Perl: Extracting date from file name and comparing with current date MKNENI Shell Programming and Scripting 4 03-26-2008 04:01 PM
date issue-find prevoius date in a patricular format bsandeep_80 UNIX for Advanced & Expert Users 3 11-15-2007 08:42 PM
Changing Creation Date to a Prespecified Date of a File In Unix monkfan UNIX for Dummies Questions & Answers 4 11-28-2006 07:15 AM
a simple way of converting a date in seconds to normal date travian HP-UX 2 11-23-2006 12:25 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 01-19-2004
mccoubreyr mccoubreyr is offline
Registered User
  
 

Join Date: Jun 2002
Posts: 5
Add Date

I have a file with date and time in it YYYYMMDDHHMISS

cat payt_date.dat
20031007201031

and I need to add 10minutes

Any ideas?
  #2 (permalink)  
Old 01-19-2004
oombera's Avatar
oombera oombera is offline Forum Advisor  
Registered User
  
 

Join Date: Aug 2002
Location: Cleveland, OH
Posts: 804
Is this what you want? If not, explain more about what you're trying to do...

sed 's/20031007201031/20031007202031/g' payt_date.dat
  #3 (permalink)  
Old 01-19-2004
mccoubreyr mccoubreyr is offline
Registered User
  
 

Join Date: Jun 2002
Posts: 5
the date field could be any date/time , I need a shell that works out the date + 10 minutes . I should have explained this.
  #4 (permalink)  
Old 01-20-2004
Ygor's Avatar
Ygor Ygor is offline Forum Staff  
Moderator
  
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,408
The shell is not the best tool for date/time arithmetic. Assuming you have perl...
Code:
#!/usr/bin/ksh
touch -t $(sed 's/\(..\)$/.\1/' payt_date.dat) payt_date.dat
perl -e '
  ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
    $atime,$mtime,$ctime,$blksize,$blocks)=stat("payt_date.dat");
  ($ss,$mm,$hh,$DD,$MM,$YY)=localtime($mtime+600);
  printf "%04d%02d%02d%02d%02d%2d\n",$YY+1900,$MM+1,$DD,$hh,$mm,$ss;
' > payt_date_plus_ten.dat
cat payt_date_plus_ten.dat
20031007202031
  #5 (permalink)  
Old 01-20-2004
mccoubreyr mccoubreyr is offline
Registered User
  
 

Join Date: Jun 2002
Posts: 5
:)

thanks
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 04:16 PM.


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