Nested match rules using awk The 2019 Stack Overflow Developer Survey Results Are InNeed help in SED and AWKstripping a string using awkExtract word from string using grep/sed/awkformatting with awkWhy doesn't my awk pattern match the configure arguments of nginx -V?Bash help: awk columnsIf two columns partially match, replace third with awkUsing AWK to get second columnExtract only package name without version using awk or sedDelete multiple columns using awk or sed
What could be the right powersource for 15 seconds lifespan disposable giant chainsaw?
Should I use my personal e-mail address, or my workplace one, when registering to external websites for work purposes?
Landlord wants to switch my lease to a "Land contract" to "get back at the city"
Can we generate random numbers using irrational numbers like π and e?
Geography at the pixel level
Is flight data recorder erased after every flight?
Are spiders unable to hurt humans, especially very small spiders?
The difference between dialogue marks
Deal with toxic manager when you can't quit
Multiply Two Integer Polynomials
Why was M87 targetted for the Event Horizon Telescope instead of Sagittarius A*?
What is the meaning of Triage in Cybersec world?
What is the meaning of the verb "bear" in this context?
Looking for Correct Greek Translation for Heraclitus
Why isn't airport relocation done gradually?
Can a flute soloist sit?
Pokemon Turn Based battle (Python)
Is this app Icon Browser Safe/Legit?
Falsification in Math vs Science
For what reasons would an animal species NOT cross a *horizontal* land bridge?
If I score a critical hit on an 18 or higher, what are my chances of getting a critical hit if I roll 3d20?
Where to refill my bottle in India?
How to answer pointed "are you quitting" questioning when I don't want them to suspect
What is the accessibility of a package's `Private` context variables?
Nested match rules using awk
The 2019 Stack Overflow Developer Survey Results Are InNeed help in SED and AWKstripping a string using awkExtract word from string using grep/sed/awkformatting with awkWhy doesn't my awk pattern match the configure arguments of nginx -V?Bash help: awk columnsIf two columns partially match, replace third with awkUsing AWK to get second columnExtract only package name without version using awk or sedDelete multiple columns using awk or sed
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
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 'fprint;f=0 /^3::/f=1'
which will give me
` fs.suid_dumpable = 0`
but its not scale to multi-lines
bash sed awk
add a comment |
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 'fprint;f=0 /^3::/f=1'
which will give me
` fs.suid_dumpable = 0`
but its not scale to multi-lines
bash sed awk
add a comment |
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 'fprint;f=0 /^3::/f=1'
which will give me
` fs.suid_dumpable = 0`
but its not scale to multi-lines
bash sed awk
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 'fprint;f=0 /^3::/f=1'
which will give me
` fs.suid_dumpable = 0`
but its not scale to multi-lines
bash sed awk
bash sed awk
asked 2 days ago
asadzasadz
137113
137113
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1132226%2fnested-match-rules-using-awk%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1132226%2fnested-match-rules-using-awk%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown