Tuesday, October 15, 2013

Changing the Date Field of a Big File from A to B

WWW.UNIXBABUFORUM.INI have a big unl (database file) that I need to change the date field from, for example"06/01/2013" to"06/03/2013". 
How can I do it?
www.unixbabuforum.inFor I in `cat file` 
Do 
Sed -e "s/12\/06\/2013/12\/07\/2012/g" file > newfile 
Done 

www.unixbabuforum.inIf this is text file you can replace this with sed: 
sed s/06\/01\/2013/06\/03\/2013/g filename 
But if this is binary file better do this with the instruments of database. In Oracle this will be something like: 
update tablename set field='06/03/2013' where filed='06/01/2013';
www.unixbabuforum.in If you want to change time stamp, just use 
"touch" command 
but if you want to change content of file, you must write a simple SQL 
statement 
 your file is not a text file(databases are negatively B* format)

0 comments:

Post a Comment

 
Design by BABU | Dedicated to grandfather | welcome to BABU-UNIX-FORUM