The awk way:
$ cat file.txt | awk '{gsub("[ ]+"," ");print}'
The tr way:
$ cat file.txt | tr -s " "
$
cat file.txt | tr -s " "
where -s stands for squeeze and can be used on any character not only spaces
The sed way:
$ cat file | sed -r 's/[ ]+/ /g'
No comments:
Post a Comment