views:

108

answers:

3

File1:

hello      world
foo   bar
a  word with a space

I need to replace all white spaces which are two or more in length with a semi-colon(;).

Result:

File2:

hello;world
foo;bar
a;word with a space
A: 

Try:

sed -e 's/  */;/g' file
Will Hartung
Removed spaces of one length as well DX.
+3  A: 
sed -e 's/  \+/;/g' File1 > File2
Robert Gamble
Sweet! Saved me tonnes of time.
A: 
$ 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
ghostdog74