Computing.Net > Forums > Unix > How to edit large files?

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.

How to edit large files?

Reply to Message Icon

Name: AnjiReddy_Puli
Date: July 17, 2006 at 05:47:46 Pacific
OS: SunOS 5.8
CPU/Ram: PIV
Product: Dell
Comment:

I want to edit the first line in a large file. Using VI editor I amn't able to do, so that I thought to do using head and tail functions and then done successfully. Is there any way to achieve this in single command? Likewise anyone can give a single command to go nth line a file!
I know we can achive this using "head -n filename | tail -1", but I want to know any other option to get n'th line in a file.

Thanks and Regards,
AnjiReddy.



Sponsored Link
Ads by Google

Response Number 1
Name: aakashunix
Date: July 18, 2006 at 04:10:53 Pacific
Reply:

Vi will be the best to do so if your file is not bigger than 2 gigs. If yes, then do the following

1. open VI without a file name.
2. In the command mode, type :set directory=<any directory with enough free space>
3. now open the file using :e <file name>

HOpe this works for you.


0

Response Number 2
Name: FishMonger
Date: July 18, 2006 at 23:50:21 Pacific
Reply:

Using vi, you can open the file and position the cursor at a given line number e.g. line 5 like this:

vi +5 filename


0

Response Number 3
Name: Thennarasu Eswaran
Date: July 25, 2006 at 07:34:10 Pacific
Reply:

Hi FishMonger,

It's working great!!!


Thanks,
Thennarasu Eswaran


0

Response Number 4
Name: Thennarasu Eswaran
Date: July 25, 2006 at 22:45:05 Pacific
Reply:

In vi editor,
Press ESc
type :
and type the line number the cursor gets moved to the needed line.

(or)

press ESC
type G
type the line number
(If didn't specify by default the cursor will move to the last line in the file)

Thanks,
Thennarasu Eswaran


0

Sponsored Link
Ads by Google
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: How to edit large files?

How to Read .txt file and edit www.computing.net/answers/unix/how-to-read-txt-file-and-edit/7947.html

How to delete a file named -x www.computing.net/answers/unix/how-to-delete-a-file-named-x/3350.html

How to edit bootdisk www.computing.net/answers/unix/how-to-edit-bootdisk/3464.html