How can I copy a particular content of a file into a new file using Linux?
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.
Is there any single line command in LINUX/UNIX?
试试这个:
sed -n '200,700p' logfilename > destinationFilename
try this line:
awk 'NR>700{exit}NR>=200{print $0 > "newfile"}' yourlog
the line above will stop processing after line 700. it is helpful if your log file is huge.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.