Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个大约 10 GB 的大文件。我想替换它的第 35 列(用 ; 分隔)。因为它是一个巨大的文件,所以不能在编辑器中打开文件。我想在文件的所有行中进行替换。
有人建议我使用 Sed,但我还不习惯。有人可以建议一个可以实现相同功能的 unix 命令。
awk -F';' '{ $35 = "replacement" }' < oldfile > newfile
这可能对您有用(GNU sed):
sed -i 's/[^;]*/replacement/35' file
接受的解决方案对我不起作用。但帮助我找到了这个:
awk '{$35 = "替换"; 打印 $0}' <旧文件> 新文件
对于制表符分隔的文件