java - I have a csv file with two different formats of date value, want them to be in any single format -


my csv file looks this

id       date 1602    11/23/2015 14:10 1602    11/23/2015 22:45 1602    18/10/2011 09:19:46 1702    18/10/2011 09:07:33 1863    18/10/2011 09:07:35 1436    18/10/2011 09:07:36 

i'm looking output like

id date 1602 11/23/2015 14:10 1602 11/23/2015 22:45 1602 10/18/2011 09:19:46 1702 10/18/2011 09:07:33 1863 10/18/2011 09:07:35 1436 10/18/2011 09:07:36 am

i'm not sure why making more difficult is. seems doing (1) getting rid of first line of csv file; (2) tossing out quotation marks; (3) mapping sets of spaces/tabs single spaces; , (4) mapping newlines spaces.

so . . . how following? (i assume data comes standard input.)

sed 1d | tr -d /\"/ | tr -s "/[ \010\012]/ /"

the 'sed' deletes first line; first 'tr' strips quotation marks; second 'tr' maps runs of spaces, tabs, and/or newlines single spaces (\010 , \012 octal codes ascii tab , ascii nl, respectively).


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -