Hi,
I have a file that contains whitespaces with spaces and spaces and tabs on each line and am wanting to remove the whitespaces. My version of sed is one that does not recognize \t etc.
The sed and awk one-liners below that I found via Google both does not work.
So my next best option is to use tr, am using tr -d '[:space:]' < in > out and while that one works, I am unfortunately losing the line endings.
When I run the tr command
The input below:
server01 :/mnt/arch :20 :15 :40 :85 :N :
server02 :/mnt/arch2 :32 :15 :40 :85 :N :
Becomes:
server01:/mnt/volarch:20:15:40:85:N:server02:/mnt/arch2:32:15:40:85:N:
Preferably, I want it to be as below:
server01:/mnt/volarch:20:15:40:85:N:
server02:/mnt/arch2:32:15:40:85:N:
At the moment since I don't know how to get around this, am using a while read loop that reads each line and running tr -d '[:space:]' on each line. I believe this is a bit of an overkill.
Can anyone advise whether I should be able to get the desired result using tr instead of the while loop?
Thanks in advance.