[PLUG] Correcting duplicate strings in files

Robert Citek robert.citek at gmail.com
Tue Jun 19 21:53:06 UTC 2018


A quick pass.  Needs testing and refactoring.

$2 != "16.00" { print ; next }
flag == 0 && $2 == "16:00" { print ; flag=1 ; next }
flag == 1 && $2 == "16:00" { $2=="17:00"; print; flag=0 ; next }


On Tue, Jun 19, 2018 at 2:04 PM, Rich Shepard <rshepard at appl-ecosys.com> wrote:
> On Tue, 19 Jun 2018, Robert Citek wrote:
>
>> Good luck and let us know how things go.
>
>
>   This can be done using awk and flags. I've not before used flags in awk so
> I don't know the proper sequence of commands. What I have now is:
>
> $2!="16.00" { print }
> $2=="16:00" { print; flag=1 }
> $2=="16:00" { $2=="17:00"; print; flag=0 }
>
>   This prints the input file without change. If anyone has thoughts on how
> to use a flag to change the value of field 2 please share them with me.
>
>
> Rich
> _______________________________________________
> PLUG mailing list
> PLUG at pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug



More information about the PLUG mailing list