I have file content as
0::chkconfig --list autofs::
autofs 0:off 1:off 2:on 3:on 4:on 5:on 6:off
1::grep "^PROMPT=" /etc/sysconfig/init::
PROMPT=yes
2::rpm -q prelink::
prelink-0.4.0-2.el5
3::sysctl fs.suid_dumpable::
fs.suid_dumpable = 0
4::stat /etc/motd::
File: `/etc/motd'
Size: 17 Blocks: 16 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 10125343 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2019-04-08 07:54:03.000000000 +0500
Modify: 2019-03-30 19:22:13.000000000 +0500
Change: 2019-03-30 19:22:13.000000000 +0500
5::stat /etc/issue::
File: `/etc/issue'
Size: 52 Blocks: 16 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 10125494 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2019-03-30 19:12:13.000000000 +0500
Modify: 2012-02-25 22:01:14.000000000 +0500
Change: 2019-03-30 23:54:57.000000000 +0500
I want first match to grab everything
me between
:: <everything>\d::
note: :: is followed up with \n new line (want to skip first ::)
\d for regex can be 3 places 999 (max).
The second match is to search within the first match
for e.g for 5::
Access: (0644/-rw-r--r--)
grab access 0644
The second match rule criteria is not fixed and will change depending upon requirement, but the first match rule is same.
The output of final match be just the matched string and not the whole record or result.
So, far i have tried with
cat org_op.2019.04.08-12.49.38 | awk 'f{print;f=0} /^3::/{f=1}'
which will give me
` fs.suid_dumpable = 0`
but its not scale to multi-lines