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
Compare date from db2 table to yesterday's Unix system date sasaliasim Shell Programming and Scripting 9 12-01-2008 11:37 PM
Compare date of file and directory odd_r Shell Programming and Scripting 2 08-26-2008 10:39 AM
compare date with date in file siog UNIX for Dummies Questions & Answers 2 10-04-2006 01:10 PM
compare today's date with date in a file siog UNIX for Dummies Questions & Answers 4 10-04-2006 12:55 PM
Log File date compare for user defined range mojo24 Shell Programming and Scripting 0 05-05-2006 07:39 AM

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 12-08-2008
research3 research3 is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 88
Compare date in a csv file

Hi all,

how can I compare two defferent lines in a csv file, with the date values,
and print the latest date!



example:

cat test.csv

test1;whatever;Wed Nov 26 14:17:48 CET 2008
test1;whatever;Wed Nov 26 17:14:06 CET 2008


Any suggession?
  #2 (permalink)  
Old 12-08-2008
ahmedwaseem2000 ahmedwaseem2000 is offline
Registered User
  
 

Join Date: Aug 2005
Location: Bangalore
Posts: 219
not sure though. try something like this.


Code:
awk '{getline nextline; if ( nextline == $0 ) print "MATCHING" }' filename

  #3 (permalink)  
Old 12-08-2008
research3 research3 is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 88
sorry, no result.

I mean, my goal is to compare the date "Wed Nov 26 17:14:06 CET 2008" and "Wed Nov 26 14:17:48 CET 2008" parts with the current date and print the latest one!
  #4 (permalink)  
Old 12-08-2008
sha7khan sha7khan is offline
Registered User
  
 

Join Date: Dec 2008
Location: India
Posts: 3
something like following should work.

cat file.csv | awk -F\; '{printf "%s,",$0;system ("date +%s -d " "\""$3"\"" );}' |sort -n
  #5 (permalink)  
Old 12-08-2008
research3 research3 is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 88
Thanks a lot sha7khan!
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 12:37 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