June 29th, 2012, 12:28 AM
Help required in validating a pipe delimited file using shell script
I have a pipe delimited file which contains the header and then the data.
I have a requirement which needs that the value in the date columns hroughout the file be checked for a particular format as DDMMYYYY.
The problem i'm facing in is building up the logic as to how can i scan all the records in the file when i don't exactly know which column's can be the date column's.
Need your help urgently.
Sample Data: 260.00|12062012|12062012|INR|12062012
June 29th, 2012, 09:02 AM
If you do not know which columns will include a date you wish to validate you are on a hiding to nothing from the start.
Assuming that you will know which columns should be dates you could do this in a few ways - using awk -F\| and having a validation function in the awk script (so you don't have to repeat code) would be a favourite.
The moon on the one hand, the dawn on the other:
The moon is my sister, the dawn is my brother.
The moon on my left and the dawn on my right.
My brother, good morning: my sister, good night.
-- Hilaire Belloc