remove duplicate

Hi,

I am tryung to use shell or perl to remove duplicate characters
for example , if I have " I love google" it will become I love ggle"
or even "I loveggle" if removing duplicate white space

Thanks
CC

Please post a better example with the input, process rules, and output clearer.
As posted the duplicate space rule is inconsistent with the duplicate character rule.

To make it simple

if original input is "I love yahoo"
I need remove duplicate words
so it will become

I love yah

You mention "duplicate words", but you have removed duplicate characters in your expected output.
So I shall assume you want to remove duplicate characters, and not words.

$
$ cat f2
i love google
i love yahoo
i am tech savvy
$
$ perl -lne 's/(.)\1//g; print' f2
i love ggle
i love yah
i am tech say
$
$

tyler_durden

echo I Love Yahoo | sed 's/\([a-z]\)\1//'

tyler

it seems not right

"I love yahoo" becomes " I love yah" because "o" appears in love once
so "I am tech savvy" should become " I am tech savy"
Thanks
CC

Nope, that's an incorrect statement. The correct statement is:

"I love yahoo" becomes "I love yah" because "o" appears in "yahoo" twice, and hence (both occurrences are) removed.

Going by the stated requirement in your first post:

and noting that the only duplicate characters in "I am tech savvy" are the two "v"s in "savvy", they should be removed, thus resulting in "I am tech say".

tyler_durden