Results 1 to 1 of 1
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 ...
- 05-19-2011 #1Just Joined!
- Join Date
- May 2011
- Posts
- 3
finding and removing block of identical string
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:
Code:
Code:
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"
pls help me
thanksLast edited by cocostaec; 05-19-2011 at 03:13 PM.


Reply With Quote