We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


file too large to open for Vi editing

Kyliem asked
Medium Priority
Last Modified: 2013-12-26
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

Watch Question

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


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



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.

> .. 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

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


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?



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 ?



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?


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.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.