unix - What is a grep command performs? -


im trying understand unix command im not quite expert on this, explain more in detail?

grep '^.\{167\}02' 

what perform?

from man page (man grep)

grep searches named input files (or standard input if no files named, or if single hyphen-minus (-) given file name) lines containing match given pattern. default, grep prints matching lines.

check part in bold: if don't specify files want search in, wait , listen keyboard input , regex match each new line type.

if want test it, suggest using easier regex, maybe less characters one: ^.\{3\}02 , see happens:

$ grep '^.\{3\}02' 02 002 0002 00002 <-- matches , later printed , highlighted 00002 

you don't use grep , type lines see if matches, give files argument, or input using pipe:

ls -la | grep '^.\{167\}02' 

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -