Join David D. Levine for an in-depth discussion in this video Specifying multiple commands with -e and -f, part of SED Essential Training.
- When no command options are used,…for example in…sed the THE dukeofyork.txt,…SED interprets the first argument…on the command line as a command,…in this case, an s command.…And any following words as file names to operate on.…If you wanted to perform two operations…in a single sed command,…for example, to change the first lowercase up on each line…to all caps and the first lowercase down on each line…to all caps, you might try this,…sed we'll change up to uppercase up…and we'll change down to uppercase down.…
You might try that, but it doesn't work.…The second s command is interpreted as a filename,…and there is no file called s/down/DOWN/.…To specify multiple commands to SED…in a single command line,…precede each command with the minus e flag.…For example, sed minus e change up to up,…and minus e change down to down.…The -e flag tells SED that the following argument…is a command, and not a filename.…
So in this case, we're changing the first up to uppercase,…and the first down to also uppercase.…And in the last line you see that both commands…
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.