在Linux上的6 GB文件中用硬标签替换空格字符

mad*_*tty 1 linux vi awk replace sed

我有一个vi命令,用硬标签替换空格字符:

     vi myfile.txt
       : # To go to the last line 
          1,$s/ /\t/g   # Then I type in this to replace spaces by a tab
Run Code Online (Sandbox Code Playgroud)

我怎么能用AWKsed做到这一点?

ssa*_*ota 5

除非你严格要求sed/ awk,否则tr它是最好的选择:

tr ' ' '\t'  < inputfile > outputfile
Run Code Online (Sandbox Code Playgroud)