Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selecting a part of a file and copying that into new file in Linux

Tags:

linux

text

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?

like image 887
user2135240 Avatar asked Mar 05 '13 10:03

user2135240


1 Answers

Try this:

sed -n '200,700p' logfilename > destinationFilename
like image 85
Anubhab Avatar answered Nov 15 '22 20:11

Anubhab