Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to cut a file on AIX

Status
Not open for further replies.

Tison

Programmer
May 12, 1999
216
CH
How do I cut a file in AIX ?
ie I want to split out lines 1000 to 1100 from a huge file (20000 lines).
 
Use the vi editor as follows :-
type
vi (filename) return
shift colon return
set number return
put in first line number to delete , last line number to delete space d
(e.g. 1000,200 d )
shift colon
wq (when you are happy you have deleted the correct lines)
if not happy use q! to disregard the changes.
NOTE copy the file somewhere before you do this just in case you screw up !!
 
Tison,

You have answered the question yourself, check out the split command :

man split

This will do what you require.

Cheers

PSD
HACMP Specialist
 
Or use AWK:
[tt]
awk 'NR >= 1000 && NR <= 1100' /name/of/file > /file/with/extracted/lines
[/tt]

I hope it works...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top