File1:
hello world foo bar a word with a space
Мне нужно заменить все пробелы, длина которых составляет два или более, точкой с запятой (;).
Результат:
File2:
hello;world foo;bar a;word with a space
sed -e 's/ \+/;/g' File1 > File2
$ gawk 'BEGIN{FS=" +"}{$1=$1}1' OFS=";" file hello;world foo;bar a;word with a space $ awk '{gsub(/ +/,";")}1' file hello;world foo;bar a;word with a space
Попробуйте:
sed -e 's/ */;/g' file