Need help in editing a file

I have a file which has 10 million records in it. When am trying to edit the file with vi, the following error occurs:

~
~
~
~
~
~
~
~
"file1" Value too large for defined data type

Is there any way that I can edit this file without using vi? Any help would be really appreciated.

Thanks
B

If your native OS is windows, scp it to local and open it in a text editor or gvim.

Does this helps:

$ uname -a
SunOS inf3.xxxbank.com 5.10 Generic_147440-07 sun4u sparc SUNW,Sun-Fire-V890

What does scp mean?

secure copy. He's just suggesting you copy the file over the network to somewhere it can be edited.

Is this similar to vour previous large file?
http://www.unix.com/shell-programming-scripting/173191-how-edit-large-file-2.html
Similar questions to before:

Is it a properly formatted unix text file?
How do you normally edit similar (but smaller) files?
How big is the file?
What editing do you need to do?
What software created the file?

Yes, it was a similar kind of file that has been posted before.

Its a txt file.
I normally edit with vi, but this file being so gigantic, I cannot edit the file and encountered with an error.
The file which am trying to edit has about 10 million records in it.

Editing required:

  1. I need to cut the very first few lines and copy them into a seperate file.
  2. Need to replace the data with some data for the 9th million record.

Any help would be really appreciated.

What separator does this text file use? If it's just spaces, awk can handle that without trouble. Otherwise, you'll need to specify it with awk' -F option as well as

-v OFS="|"

For example, for a separator of |, you'd do

nawk -F"|" -v OFS="|" ...
nawk '# Lines <= 1000 copy into file2
(NR<=1000) { print > "file2" }
# Replace column 3 with slartibartfast in line 9,000,000
NR==9000000 { $3 = "slartibartfast" }

# print all lines
1' < inputfile > outputfile

The file 'outputfile' will have the changes in it. The file 'file2' will have lines <= 1000.

I didnt quite get that. I am a novice in UNIX..Sorry to say this, the code seems to be more complicated..

I explained everything in detail when I wrote it. If you have more specific questions, I can give more specific answers.