[Omaha.pm] Convert date formats in text files

Jay Hannah jhannah at omnihotels.com
Mon May 7 10:09:43 PDT 2007


Project:

For all text files in a directory, change all instances of "YYYY-MM-DD
HH:MM:SS" to "YYYYMMDD". 


Solution:

perl -pi -e 's/(\d\d\d\d)-(\d\d)-(\d\d) \d\d:\d\d:\d\d/$1$2$3/g' *.txt


j



More information about the Omaha-pm mailing list