From the course: Learning vi
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Filtering text through shell commands - vi Tutorial
From the course: Learning vi
Filtering text through shell commands
One of the more powerful features of VI is its ability to filter the text that you're editing through shell commands. The exclamation point performs a filter, which is to say it takes text out of your current editing buffer, passes it through as a standard input of a shell command, which you type just the same as you would at a command prompt. And then returns the output of that command into the file. So as with the delete command, the exclamation point command. If you double it, acts on the current line. If you precede it with a number, it acts on that many lines. If you follow it with a movement command, it acts on that specified textural unit. So for example, you can use exclamation point, exclamation point or for short bang, bang to filter a single line. You can say five bang bang to filter the current line, and form more lines after that. Bang percent filters from here to the matching parenthesis brace or bracket. Paren brace filters the next paragraph, or paren left brace…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.