help


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users help
# 1  
Old 09-26-2008
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
# 2  
Old 09-26-2008
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

# 3  
Old 09-26-2008
Hi
Thanks,its working fine

Thanks,
Akil
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question