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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -