file too large to open for Vi editing

SCO Unix system. :-

Hi, I need to edit some dates in a transaction file but the file is quite big and won't open as temp table.

I know the specific dates I want to change and don't need be selective so a find/replace funtion would be all I need.

Can this be done with vi at command line without having to open the file in its entirety ?

My knowledge of vi is basic (I can get around!) and I do not know Awk or Sed.

Many thanks

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

awk, sed or perl would be the better solution, probably
Tell us which pattern should be replaced by which text, and we can suggest a solution

If you're adicted to use vi, you may either try
  vi -R hugefile
which opens in read-only mode and does not use a tmp-file, you can save changes there with

or you can use split to size down your file, see
  man split
KyliemAuthor Commented:
hi, thanks, I simply want to replace a date (in format dd/mm/yyyy) eg  26/02/2006 with date of 27/02/2006   I know there are about 25 lines in total to be changed out of what is a large file.

I thought about sed command 'g/{olddate}/s/{olddate}/{newdate}/g/p'   and was going to put it in a 1 line script and call it using command line:  
sed -f -n {scriptfile} {myfile} > {newfile}

{} not included in command line obviously and I expect I would need use backslash to negate the command line '/' in my date format yes.

I will also try the read-only mode, cheers very much

KyliemAuthor Commented:
I would have typed the command I thought about using in full but my keyboard refuses to return the backslash character, I get hash # instead.  Not very helpful for scripting !  but luckily I won't be using the pc to do it on.

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

> .. my keyboard refuses to return the backslash character,
your keybord returns characters?
I guess you mean something else ;-)
check with
 stty -a

sed -e 's#26/02/2006#27/02/2006#g' <oldfile>newfile
# or
perl -i.bak -pe 's#26/02/2006#27/02/2006#g' file

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
KyliemAuthor Commented:
Hi, now you have confused me.  Did you mean to use the char$ '#' when typing your commands out?  do they represent spaces or slashes ?

Does it not need the date to be specified as 26\/02\/2006 so that the '/' doesn't get interpreted as a command to follow?

KyliemAuthor Commented:
The -R read only mode still returns a Temp file too large error and I cannot access the lines I want for editing purposes.  

If I did use 'split' what command would I use to re-join them all ?

KyliemAuthor Commented:
Ignore the query regards # and spaces.  nothing like getting round to testing it.  I'm ok now, can carry on and try editing the file.
> The -R read only mode still returns a Temp file too large ..
strange ...
try using view instead vi -R
or you can use another place for temp file (/var/tmp by default). This is a bit tricky 'cause vi uses ex and both do not use the TMP environment variable. You either must open vi without a file and then do:
  :set directory=/path/to/huge/space
  :r your-huge-file
or you have to use ex's EXINIT environment variable before, something like:
  EXINIT="set directory=/path/to/huge/space"

> If I did use 'split' what command would I use to re-join them all ?
cat fileaaa fileaab fileaac > file

> Ignore the query regards # and spaces.
what do you mean here?
KyliemAuthor Commented:
Hi, your sed command:   sed -e 's#26/02/2006#27/02/2006#g' <oldfile>newfile
  worked ok so am accepting this answer in respect to question asked.  However, since the date change effected, caused a duplicate record error, (valid error due to transactions found on subsequent days) I will have to edit the file and will need use a large temp file area so many thanks for the extra info on using vi and EXINIT.  I expect to use this info and have upped the pts value respectively.  

many thanks
glad to have helped, somehow ..
Good Luck.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.