Join David D. Levine for an in-depth discussion in this video Managing the hold buffer with "g", "G", "h", "H," and "x", part of SED Essential Training.
- Finally, let's look at the hold buffer.…If you've ever used a pocket calculator…or a calculator app with a memory function,…the hold buffer is similar.…It's a separate memory, which you can use…to hold data while performing another operation.…The h command holds, or copies,…the pattern space into the hold buffer.…The g command copies or gets…the hold buffer into the pattern space.…The uppercase H and G commands…append the pattern space to the hold buffer…or vice versa,…and the x command exchanges…the pattern space and the hold buffer.…
The h command, for hold, copies the…pattern space into the hold buffer.…And the G command, for get,…copies the hold buffer into the pattern space.…Here's a simple example.…On line two, we'll hold with the h command.…On the last line of the file, we'll print and then get.…Control d ends the script.…And here, I'd like to point out that…the dollar sign next to the cursor is the prompt…whereas the dollar sign a few lines above it is actually…a dollar sign that's in the script.…
Let's see what happens when you execute that script.…
AuthorDavid D. Levine
- Understanding input, output, files, and pipes
- Modifying the "s" command
- Using character classes and quantifiers
- Controlling printing
- Reading and writing files
- Appending, inserting, and editing entire lines
- Writing programs in SED
- Using advanced programming commands
Skill Level Intermediate
1. Sed Command-Line Basics
2. Regular Expressions
Using & and \n5m 34s
3. Sed Command-Line Flags
4. More sed Commands
5. Writing Programs in sed
Exiting with "q" and "d"3m 5s
6. Advanced Programming Concepts
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.