Nested match rules using awkNeed 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
Are cabin dividers used to "hide" the flex of the airplane?
Need help identifying/translating a plaque in Tangier, Morocco
Can a planet have a different gravitational pull depending on its location in orbit around its sun?
Is there a familial term for apples and pears?
Information to fellow intern about hiring?
Does bootstrapped regression allow for inference?
Where to refill my bottle in India?
What does "enim et" mean?
How to answer pointed "are you quitting" questioning when I don't want them to suspect
Why is the design of haulage companies so “special”?
Domain expired, GoDaddy holds it and is asking more money
Piano - What is the notation for a double stop where both notes in the double stop are different lengths?
Symmetry in quantum mechanics
Is ipsum/ipsa/ipse a third person pronoun, or can it serve other functions?
LWC and complex parameters
Doomsday-clock for my fantasy planet
What is the meaning of "of trouble" in the following sentence?
Is Fable (1996) connected in any way to the Fable franchise from Lionhead Studios?
Can I find out the caloric content of bread by dehydrating it?
Is Social Media Science Fiction?
Can I legally use front facing blue light in the UK?
Calculate Levenshtein distance between two strings in Python
How would photo IDs work for shapeshifters?
How can I fix this gap between bookcases I made?
Nested match rules using awk
Need 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 7 hours 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