Join David D. Levine for an in-depth discussion in this video Understanding input, output, files, and pipes, part of SED Essential Training.
- The basic command…sed 's/old/new/'…file…reads from the file and writes to standard output.…But you can specify more than one file…in which case they are read in order.…For example,…sed lower case the, to upper case THE…dukeofyork.txt…and array.c pipe the result through more.…So here we see the dukeofyork file…with lower case the replaced with all caps…immediately followed by array.c…with lower case the replaced with all caps.…
See there is an example in the middle of the screen.…You can also omit the file if we said…'s/the/THE' with no file…it processes the standard input.…You can use ctrl + d to terminate that standard input.…Omitting the file argument like this is generally used…to process the output of some other program…in a shell script.…For example we can use the nl command…which simply numbers its lines.…
Pipe the output of that through…'s/the/THE/' with no file argument,…and you see that the line numbered output of nl…has then been transformed by SED.…SED can also be used as a filter within vi or Emacs…to perform more complex transformations…
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.