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:
I need to cut the very first few lines and copy them into a seperate file.
Need to replace the data with some data for the 9th million record.
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.