The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 09-26-2008
Registered User
 

Join Date: Jun 2008
Posts: 25
help

I want to check the data format ,if date is invalid ,replace with null.

Code:
xxxx      2001-01-01
yyyy      200-09-09
zzz      2000-009-08

xxxx      2001-01-01
yyyy      null
zzz        null
Thanks inadvance
Akil
Reply With Quote
Forum Sponsor
  #2  
Old 09-26-2008
Tytalus's Avatar
Registered User
 

Join Date: Jun 2003
Location: Scotland
Posts: 290
one way:

Code:
#  nawk '$2!~"[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]"{$2="null"}{print}' infile
xxxx      2001-01-01
yyyy null
zzz null
Reply With Quote
  #3  
Old 09-26-2008
Registered User
 

Join Date: Jun 2008
Posts: 25
Hi
Thanks,its working fine

Thanks,
Akil
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 03:53 PM.


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

Content Relevant URLs by vBSEO 3.2.0