Reputation: 171
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?
Upvotes: 15
Views: 27149
Reputation: 195079
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.
Upvotes: 4