Skip to main content
2 of 3
Command corrected
Prabhjot Singh
  • 2.4k
  • 1
  • 6
  • 20

Using gawk:

$ awk '
     n=split($0,a, "oo\\+",sep){ 
        for(i in sep) sep[i]="oo:";
        if (match(a[3], /^.{8,}pkp/)) sep[2]="o:";
        for(i=1;i<=n;i++) $0 = (i==1 ? "" : $0) sep[i-1] a[i]
  }1'
Prabhjot Singh
  • 2.4k
  • 1
  • 6
  • 20