I don't fully understand your question, but here are some examples
that may be a step in the right direction:

$ seq 1 5 | sed -e '1~2s/$/ --/'
1 --
2
3 --
4
5 --

$ seq 1 5 | sed -e '0~2s/$/ --/'
1
2 --
3
4 --
5

$ echo -e "2012-10-01,16:00,297.94\n2012-10-01,16:00,297.94" | sed -e
'0~2s/16:00/17:00/'
2012-10-01,16:00,297.94
2012-10-01,17:00,297.94

Good luck and let us know how things go.

Regards,
- Robert

On Tue, Jun 19, 2018 at 11:52 AM, Rich Shepard <rshep...@appl-ecosys.com> wrote:
>   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
> _______________________________________________
> PLUG mailing list
> PLUG@pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
_______________________________________________
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to