RE: some help parsing please
Posted in 2008
Try this - change "infile" to the name of the file with all the unload lines in it. The original file will be renamed to infile.bak and the edits done in place. perl -npi.bak -e "s{( \\d{2}:\\d{2}:\\d{2}\\.\\d{3})\\d{3}}{\\$1}g" infile Jarrod Teale ________________________________ From: informix-list-bounces@iiug.org [mailto:informix-list-bounces@iiug.org] On Behalf Of Floyd Wellershaus Sent: Thursday, 26 June 2008 6:10 a.m. To: informix-list@iiug.org Subject: some help parsing please Hi, We are doing a port over from a sqlanywhere database to informix. Many rows. In sqlanywhere, the datetime year to fraction function yields 6 integers for the fraction, but in our informix database only takes 3. So, I'm trying to parse a line like this: pierre|manager||N|A|dba|2000-07-07 15:07:06.968000|Y|N|N|N|Y and change it to this: pierre|manager||N|A|dba|2000-07-07 15:07:06.968|Y|N|N|N|Y So that it will go into the informix tables. Without knowing where the date fields, are, or how may there may be in each line. Any ideas for a quick awk or perl script that could do that ? Thanks, Floyd