bash - replace varying number of spaces in file with single space -
i have list of files have columns separated varying number of spaces. how can sed or similar each column separated single space or tab?
i tried:
sed 's/ \+ /\t/g' file > tmp sed "s/\ /\t/g" tmp > file
but r complained
line 526 did not have 11 elements
you use tr
tr -s < filename
or sed
sed -e 's/ \+/ /g' filename
inline sed
sed -i.bak -e 's/ \+/ /g' filename
Comments
Post a Comment