Computing.Net > Forums > Unix > Writing specific lines to new file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Writing specific lines to new file

Reply to Message Icon

Name: Lion1000
Date: February 20, 2008 at 18:29:13 Pacific
OS: Unix
CPU/Ram: Intel 1GB
Product: Intel
Comment:

Hi, I have a file with 60 lines. I want to write from line 10-20 to one file, 21-40 to another new file, 41-60 to another new file. Can anybody please help me on this?




Sponsored Link
Ads by Google

Response Number 1
Name: nails
Date: February 21, 2008 at 07:12:03 Pacific
Reply:

From Eric Pement's sed one-liners:
http://www.student.northpark.edu/pe...


# print section of file based on line numbers (lines 8-12, inclusive)
sed -n '8,12p' # method 1
sed '8,12!d' # method 2


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Writing specific lines to new file

Insert a line to many files www.computing.net/answers/unix/insert-a-line-to-many-files-/7125.html

removing specific line from file www.computing.net/answers/unix/removing-specific-line-from-file/5042.html

Cat, viewing specific line number www.computing.net/answers/unix/cat-viewing-specific-line-number/4544.html