12 productivity tools: grep and find, 13 transferring and archiving files, A the vi editor – HP NonStop G-Series User Manual

Page 8: B the ed editor

Advertising
background image

12 Productivity Tools: grep and find.............................................................147

Searching Files for Text Patterns (grep).....................................................................................147

Using the -i Flag .............................................................................................................148
Extracting Lines and Saving Them in Another File ................................................................148
Deleting Lines and Saving the Output in Another File ...........................................................149
Finding and Sorting ........................................................................................................149

Finding Files (find)................................................................................................................149

13 Transferring and Archiving Files..............................................................151

Filename and Directory Name Transformations.........................................................................151
The pax Utility......................................................................................................................151

Copying a Directory Hierarchy to Another Directory.............................................................152
Copying a File Hierarchy to Tape.......................................................................................152
Restoring Files From a Tape to the Guardian Environment......................................................153

The ftp Utility.......................................................................................................................153

A The vi Editor..........................................................................................155

Getting Started.....................................................................................................................155

Preparing to Use vi in the OSS Environment.........................................................................155

Setting Terminal Emulation Mode..................................................................................156
Using a .exrc File to Customize Command Keys...............................................................156

Create a Sample Edit File..................................................................................................157
Opening a File................................................................................................................157
Moving Within the File.....................................................................................................158
Entering New Text ...........................................................................................................158
Editing Text.....................................................................................................................159

Deleting Multiple Words..............................................................................................160
Changing Text............................................................................................................160
Undoing a Command..................................................................................................160

Finishing Your Edit Session................................................................................................160

Using Advanced Techniques..................................................................................................160

Searching for Strings........................................................................................................161
Moving Text....................................................................................................................161
Copying Text...................................................................................................................161
Other vi Features.............................................................................................................162

Using the Underlying ex Commands.......................................................................................162

Making Substitutions........................................................................................................162
Writing a Whole File or Parts of a File................................................................................163
Deleting a Block of Text....................................................................................................164
Moving and Copying Blocks of Text ..................................................................................164
Customizing Your Environment...........................................................................................164
Saving Your Customizations...............................................................................................164

B The ed Editor.........................................................................................166

Creating and Saving Text Files...............................................................................................166

Starting the ed Program....................................................................................................166
Entering Text—The a (Append) Subcommand......................................................................166
Displaying Text—The p (Print) Subcommand........................................................................167
Saving Text—The w (Write) Subcommand...........................................................................167

Saving Text Under the Same Filename...........................................................................167
Saving Text Under a Different Filename..........................................................................168
Saving Part of a File....................................................................................................168

Ending the ed Program—The q (Quit) Subcommand.............................................................168

Loading Files Into the Edit Buffer.............................................................................................168

Using the ed (Edit) Command............................................................................................169
Using the e (Edit) Subcommand.........................................................................................169

8

Contents

Advertising
This manual is related to the following products: