User Tools

Site Tools


команда_фильтр_grep

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
команда_фильтр_grep [2011/11/04 17:11]
val removed
— (current)
Line 1: Line 1:
-====== Команда фильтр grep ====== 
- 
-[[http://​ru.wikipedia.org/​wiki/​Grep]] 
- 
-===== Шаблон ===== 
- 
-<​code>​ 
-grep регулярное_выражение имя_файла 
-</​code>​ 
-===== Примеры ===== 
- 
-<​code>​ 
-$ grep root /etc/passwd 
- 
-$ grep '​^root'​ /etc/passwd 
- 
-$ grep '​sh$'​ /etc/passwd 
-</​code>​ 
-Ключ -r - рекурсивный перебор подкаталогов 
-<​code>​ 
-$ grep -r '​\<​sed\>'​ /usr/share 
-</​code>​ 
-Ключ -v - показать строки,​ не совпадающие с шаблоном 
- 
-<​code>​ 
-FreeBSD 
-/​usr/​local/​etc/​apache/​httpd.conf 
- 
-Linux 
-/​etc/​apache2/​apache2.conf 
-/​etc/​apache2/​sites-available/​default-ssl 
-</​code>​ 
-<​code>​ 
-$ grep -v '​^#'​ file 
-$ grep -v '^ *#' file 
-$ grep -v '^ *#​\|^$'​ file 
-</​code>​ 
- 
-Ключ -E - использовать расширенные регулярные выражения 
-<​code>​ 
-$ grep -vE '^ *#|^$' file 
-</​code>​ 
  
команда_фильтр_grep.1320412261.txt.gz · Last modified: 2013/05/22 13:50 (external edit)