linux - Printing more than one line after a match -


$ cat /etc/sudoers     inavg7ey evl0000332,evl0000333,evl0000234,evl0000999,evs99234456,\\  evl3300987,evl3344567,evlser999,eul000123,evs3300123,evs3300124,\\ (root,jboss,superss) nopasswd:all  inavgmcn evl0000332,evl0000333,evl0000234,evl0000999=(all,wasadmin,\\ jboss,superss) nopasswd:all 

i want print inavg7ey user details second line (if more lines there want them also).. me this? i've tried this:

awk '/inavg7ey/' /etc/sudoers 

but it's displaying one:

inavg7ey evl0000332,evl0000333,evl0000234,evl0000999,evs99234456,\

you may use:

awk '/inavg7ey/{c=n}c&&c--' /etc/sudoers

n - here number of line after match including match

and 1 solution:

awk '/navg7ey/,/^$/' /etc/sudoers

awk -may grep between 2 patterns, in file,
navg7ey - it's first pattern grep from;
^$ - it's second pattern grep (^$ - means empty line)


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -