Replacing Characters with |

Hi All,

example data.log

526569346 66815531961 09
526569346 66815531961 09
526569346 66815531961 09
526569346 66815531961 09
526569346 66815531961 09

I want like this to

526569346|66815531961|09
526569346|66815531961|09
526569346|66815531961|09
526569346|66815531961|09
526569346|66815531961|09

help me please

tr ' ' '|' < file > newfile

Regards

Franklin52, you should choose option while using tr.

 tr -s ' ' '|'  < File name > New File

How so? It's not at all clear from the sample data that the -s option is required.

Not required...

And solutions with awk and sed..

sed 's/ /|/g' < file > out
awk 'gsub(/ /,"|",$0);' < file >out