Mac iTOps Tube

Wednesday, May 16, 2012

[SOLVED] remove duplicated stringd in a line...

hi,

i have this code:




Code:


$ echo "bubu gaga bubu dede" | awk '{ while(++i<=NF) printf (!a[$i]++) ? $i FS : ""; i=split("",a); print "" }'

bubu gaga dede


i need to modify the awk command so that "-" is considered a field separator (like " ").



i.e.:


Code:


$ echo "bubu gaga bubu-dede" | awk ....

bubu gaga dede


can you help me?

many thanks...











No comments:

Post a Comment