HI I am writing a simple BASH to remove the consecutive duplicate occurrence of any word in a paragraph separated by single space and redirecting output to stdout, here is how far I got.
file1
**double double toil and trouble
fire burn and cauldron bubble bubble
tomorrow and tomorrow and tomorrow
creeps in this this petty pace from day toto day**
echo `<file1` | sed -e 's/\b\([a-z ]\+\)\1/\1/g' | cat > file2
This is outputting in a single line as below.
double toil and trouble fire burn and cauldron bubble tomorrow and tomorrow creeps in this petty pace from day to day
and missing something as it is not correctly removing occurrences.