How does this awk command work? -


the following remarkably terse command print of lines after first occurrence of pattern (including first occurrence):

awk '/pattern/,0' 

can explain how command works? how awk parse '/pattern/,0'?

(by way, didn't come this; posted on compgroups.net.)

so awk '/foo/,/bar/{print $0}' file print every line in file word foo until bar.

this /foo/,/bar/ syntax called range pattern. if first regular expression constant /foo/ matched block executed until second regular expression constant /bar/ matched. setting second regular expression constant 0 (i.e. false) never matched block executed on every line until end of file.

in awk if don't specify block of code executed condition default block {print $0} executed.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -