i have a problem in finding block of identical strings...i solved the problem in finding consecutive identical words and now i want to expand the code in order to find and remove consecutive identical block of strings...
for example the awk code removing consecutive identical word is:
input:Code:#!/usr/bin/awk -f BEGIN{ RS="[[:space:]]+"; ORS="" } match($0,/^([[:punct:]]*)([^[:punct:]]+)([:punct:]]*)$/,f){ if(x != f[2]) { print y$0;z = FNR } x = f[2]; y = RT } END{ if(z != FNR) print f[3]"\n" }
"ana are mere mere
mere si portocale
ion are prune prune."
output:
"ana are mere si portocale
ion are prune."
and now i want to expand the code to do the following:
input:
"ana are ana are mere
ion are prune ion are prune"
output:
"ana are mere
ion are prune"
thanks


Reply With Quote
Bookmarks