Link to home
Start Free TrialLog in
Avatar of mahjag
mahjag

asked on

change date stamp in a flat file

I have a flat file which has columns to be exported to a oracle table, this flat file has inside date format in the form of 2006-02-01 and 2006-02-28, I wanted to change every line that has this date format (could be any day during the month of feb) to start date as 2006-02-01 and 2006-02-07 since I want to restrict data being copied to just 7 days.

This was a problem to do manually since the file is large and also the start and end dates can be any date between 01 to 28 for the month of february.

Is there any way to do this using command line commands. Unix on which I am trying is LINUX.
SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mahjag
mahjag

ASKER

do we need to have perl for this command, I dont think I have that?
You could probably do it in awk, Linux usually has a perl
you can use the touch command
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That would also change days in January or March to 2006-02-07
but perhaps that's what you want.
You don't really say what you would want to do if you see anything other than "2006-02-01 and 2006-02-28"
> That would also change days in January or March to 2006-02-07
??
I assumed one world's standard format of writing dates, not the proprietary scary uncle Sam format ;-)
That would also change 2006-01-07 or 2006-03-28 or 2007-02-28 to 2006-02-07
I interpreted the question to mean that the first two to be unchanged and the third to be changed to 2007-02-07
I'm still not sure what the intended interpretation was.