Skip to Content
Learning Linux Shell Scripting
book

Learning Linux Shell Scripting

by Ganesh Sanjiv Naik
December 2015
Beginner
306 pages
5h 2m
English
Packt Publishing
Content preview from Learning Linux Shell Scripting

Pattern matching with the vi editor

For learning pattern matching, we will ensure that the pattern that we will search should be highlighted when the searched pattern is found.

The configuration file for vi is /etc/vimrc.

In the vi editor, give the following command to highlight search:

Sr.

Commands

Description

1

:set hlsearch

This highlights search pattern

2

:se[t] showmode

Show when you are in insert mode

3

:se[t] ic

Ignore case when searching

4

:set noic

Shows case sensitive search

The mentioned user should open the file in vi, press the Esc button so that it goes into command mode and then enter colon followed by these commands.

The following are commands for pattern search and replace:

Sr.

Commands

Description

1

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Linux Shell Scripting - Second Edition

Learning Linux Shell Scripting - Second Edition

Ganesh Sanjiv Naik

Publisher Resources

ISBN: 9781785286216