选择文件的一部分并将其复制到Linux中的新文件中 [英] Selecting a part of a file and copying that into new file in Linux

查看:181
本文介绍了选择文件的一部分并将其复制到Linux中的新文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用Linux将文件的特定内容复制到新文件中?

How can I copy a particular content of a file into a new file using Linux?

例如,我有一个名为test.log的文件,它包含约1000行.在这1000行中,我需要复制200至700行之间的行.

For example I have file called test.log file and it contains some 1000 lines. From those 1000 lines I need to copy the lines between 200 - 700 lines.

LINUX/UNIX中是否有任何一行命令?

Is there any single line command in LINUX/UNIX?

推荐答案

尝试一下:

sed -n '200,700p' logfilename > destinationFilename

这篇关于选择文件的一部分并将其复制到Linux中的新文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆