Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding & replacing strings in large files

Status
Not open for further replies.

tdfreeman

MIS
Mar 28, 2002
85
0
0
US
I need to find and replace strings in some large files. How can I do so without going into an editor? The vi editor says that the file is too large.

This file contains SQL statements to run against a database. I need to replace the page headings with a commit line so that the records commit after so many records.

Thank you in advance for your help.
 
sed is a good tool for this...

sed 's/OldString/NewString/g' OldFile > NewFile
 
Vi normaly creates a temporary file for editting in /var/tmp. Check if /var needs clearing down.
Ged Jones

Top man
 
The vi tool was not designed to support larger files.

A suggested work around is to use a GNU product called 'vim'
(VI Improved). Solaris 8.1 includes this product, but one can download it directly from this web site: VIM supports large file editing within a vi like environment.

regards ph
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top