[PLUG] Sed syntax error, the sequel

Rich Shepard rshepard at appl-ecosys.com
Tue Nov 15 23:58:31 UTC 2016


   The sed command worked on the first file (it took two runs to get all the
dates, but what's another few milliseconds, eh?) but the second file has the
dates in mm/dd/yyyy order.

   I modified the sed command to read:

s#([0-9]{2})/([0-9]{2})/([0-9]{4})#\3-\1-\2#g

and sed complains, "sed: file change-date-format.sed line 12: invalid
reference \3 on `s' command's RHS".

   I thought that since the LHS clusters were numbered in sequence that the
RHS would accept the groups in any order. Bad thought.

   How do I handle the different format?

   Here's a small data sample:

ADAIR VILLAGE STP,WR,BENTON,101701,OR0023396,NPDES-DOM-DA,PERMIT,5/31/2011
ADAIR VILLAGE STP,WR,BENTON,101701,OR0023396,NPDES-DOM-DA,PERMIT ACTION
LETTER,5/31/2011
ADAIR VILLAGE STP,WR,BENTON,101701,OR0023396,NPDES-DOM-DA,EVALUATION
REPORT,5/31/2011
ALBANY PAPER MILL,WR,LINN,101345,OR0000442,NPDES-IW-B01,PERMIT,9/30/2000
ALBANY PAPER MILL,WR,LINN,101345,OR0000442,NPDES-IW-B01,EVALUATION
REPORT,9/30/2000
ALBANY STP,WR,LINN,102024,OR0028801,NPDES-DOM-BA,PERMIT,10/31/2005
ALLVAC- ALBANY PLANT,WR,LINN,102223,OR0001716,NPDES-IW-B08,PERMIT,5/31/2006
ALLVAC- ALBANY PLANT,WR,LINN,102223,OR0001716,NPDES-IW-B08,PERMIT,11/30/2015

TIA,

Rich



More information about the PLUG mailing list