Join David D. Levine for an in-depth discussion in this video Commenting with "#"; debugging with "l" and "=", part of SED Essential Training.
- Finally, here are a few commands you can use…to help debug SED scripts and make them more maintainable.…As I mentioned earlier, comments are introduced…with a "#" at the beginning of the line.…So for example, we'll edit the script…left over from our previous lesson, we can add a comment.…So, this is what we have and when we execute it...…you see it has exactly the same effect as it did before.…The comment is just something that you can add to make notes…for yourself or other people reading the same script.…
Another command you can use for debugging is "=".…"=" simply prints the current line number.…So for example, when we edit the script,…maybe we want to know, what line number…are we on after that first "n" command?…And then again what line number are…we on after the second "n" command?…And maybe let's make sure that we're still on the same line…and print the line number again after the "s" command.…So that's what the script now looks like.…And when we execute it...…
this is what happens.…After "marched" is found on line three, we do an "n" command…
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.