Join David D. Levine for an in-depth discussion in this video Quoting command-line arguments, part of SED Essential Training.
The SED command that we've been using so far,…sed s/the/THE/ doesn't need to be quoted.…For example, if you omit the quotes like this,…it works exactly the same as it did before,…but quoting SED's command argument…is a very good habit to get into.…Quotes are needed in case the command contains a space…or a character that is special to the shell.…For example, (keyboard clicks)…sed 's/the/…some of the/' dukeofyork.txt.…
This example changes the first "the" in each line…to "some of the," but if you omit those quotes,…it doesn't work.…It fails with an error.…Here's another example.…We can change thousand (keyboard clicks)…to $1000.…(keyboard clicks)…This changes ten thousand men to ten $1000 men.…But if you omit the quotes,…(keyboard clicks)…it changes those $1000 men to 000 men…because the $1 was replaced…with the value of the variable 1,…which is the first argument of the shell itself,…which for a login shell is an empty string.…
Note, though, that if you get into the habit…of using single quotes, apostrophes can bite you.…
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.