小编Ale*_*pov的帖子

覆盖文件的前 n 行

我有一个 7gb 的文本文件,
我需要编辑该文件的前 n 行(假设 n=50)
我想按以下方式执行此操作:

head -n 50 myfile >> tmp
vim tmp # make necessary edits
substitute first 50 lines of myfile with the contents of tmp
rm tmp
Run Code Online (Sandbox Code Playgroud)

我如何完成这里的第三步?对一般问题的更好解决方案也值得赞赏注意:此环境中没有 GUI

files

3
推荐指数
1
解决办法
1231
查看次数

标签 统计

files ×1