Jun 7, 2012

sed command to identify date pattern yyyy-mm-dd hh:mm:ss.mse and replace with current date

sed -e "s/[0-9][0-9]\([0-9][0-9]\)-\([0-9][0-9]\)-\([0-9][0-9]\) \([0-9][0-9]\):\([0-9][0-9]\):\([0-9][0-9]\).\([0-9][0-9][0-9]\)/$(date +"%F %T.")$(($(date +%N)/1000000))/g" inputfile > newfile

No comments:

Post a Comment