O'Reilly logo

Expert Shell Scripting by Ron Peters

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 25Editing Files in Place

Sometimes you want to modify a file as part of the tasks run from a shell script. Although the use of sed to modify files on the fly is common, the use of ed is less familiar to many. ed is a line-oriented editor that works much like any other text editor. It opens a file, makes modifications, saves the changes, and exits. The advantage of using ed to script these interactive sessions is that the modification is performed directly on the file itself and the results are neither redirected to another file nor used to overwrite the file itself.

For example, you might want to process a large list of files, applying a single modification to all of the files. In most of these cases, the modification may not be more ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required