Remove consecutive duplicate words from a file using awk or sed

前端 未结 6 1424
不思量自难忘°
不思量自难忘° 2021-01-16 16:53

My input file looks like below:

“true true, rohith Rohith;
cold burn, and fact and fact good good?”

Output shoud look like:



        
6条回答
  •  余生分开走
    2021-01-16 17:32

    This is not exactly what you have shown in output but is close using gnu-awk:

    awk -v RS='[^-_[:alnum:]]+' '$1 == p{printf "%s", RT; next} {p=$1; ORS=RT} 1' file
    

    “true , rohith Rohith;
    cold burn, and fact and fact good ?”
    

提交回复
热议问题