[PLUG] Correcting duplicate strings in files

Rich Shepard rshepard at appl-ecosys.com
Tue Jun 19 18:52:40 UTC 2018


   I made a mistake when writing an awk script that inserts the time of an
observation with its value. I had 16:00 twice in a row rather than 16:00 and
17:00. This holds for every day in the year, and I have about 12 year's in
which to make the correction. Specifically, changing the second 16:00 to
17:00. A sample:

2012-10-01,16:00,297.94
2012-10-01,16:00,297.94

   I'm stuck trying to find a way to make the change using sed, awk, or grep.
How do I ignore the first instance and change only the second instance?

   If there's a perl script to do this, please share it with me as I'm not a
perl coder.

   I'm looking forward to learning how to do this job.

Rich



More information about the PLUG mailing list