Читать книгу Linux Bible - Christopher Negus - Страница 212

The general regular expression parser

Оглавление

The name general regular expression print (grep) sounds intimidating, but grep is just a way to find patterns in files or text. Think of it as a useful search tool. Gaining expertise with regular expressions is quite a challenge, but after you master it, you can accomplish many useful things with just the simplest forms.

For example, you can display a list of all regular user accounts by using grep to search for all lines that contain the text /home in the /etc/passwd file as follows:

 $ grep /home /etc/passwd

Or you could find all environment variables that begin with HO using the following command:

 $ env | grep ^HO

Linux Bible

Подняться наверх