O'Reilly logo

Linux in a Nutshell, Fourth Edition by Aaron Weber, Stephen Figgins, Ellen Siever

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

global

Synopsis

[address] g[!]/
                  pattern
                  /[commands]

Execute commands on all lines that contain pattern or, if address is specified, on all lines within that range. If commands are not specified, print all such lines. If ! is used, execute commands on all lines that don’t contain pattern. See v.

Examples

                  g/Unix/p               
                  Print all lines containing "Unix"
:g/Name:/s/tom/Tom/     
                  Change "tom" to "Tom" on all lines 
                        containing "Name:"

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required