shell - Remove Blank Space between fields -
i have more 400,000 fields in input.txt
separated blank spaces. example 0 2 1 1 1 2
repeated 400,000 times.
i need put them 021112
.
how do that?
there many ways this, concise use tr
delete spaces:
tr -d ' ' < file > outfile
alternatively sed
:
sed -i 's/ //g' file
warning: sed
solution overwrites original file changes.
since asked awk
general solution set blank ofs
, force rebuild $1=$1
it's not elegant first 2 solutions:
awk '{$1=$1}1' ofs= file > outfile
Comments
Post a Comment