Strange result with SED Pattern and Hold spaceWhat does x option for sed do actually when exchanging data...
Why isn’t the tax system continuous rather than bracketed?
Set vertical spacing between two particular items
How can I convince my reader that I will not use a certain trope?
Did Chinese school textbook maps (c. 1951) "depict China as stretching even into the central Asian republics"?
Can you get infinite turns with this 2 card combo?
How to modify the uneven space between separate loop cuts, while they are already cut?
Dold-Kan correspondence in the category of symmetric spectra
Pronunciation of "œuf" in "deux œufs kinder" and "bœuf "in "deux bœufs bourguignons" as an exception to silent /f/ in the plural
Are there any vegetarian astronauts?
Anagram Within an Anagram!
Cross over of arrows in a complex diagram
Symbol for "not absolutely continuous" in Latex
What do you call the action of someone tackling a stronger person?
How was film developed in the late 1920s?
Is there a short way to check uniqueness of values without using 'if' and multiple 'and's?
Do sudoku answers always have a single minimal clue set?
Dual statement category theory
How come I was asked by a CBP officer why I was in the US when leaving?
What's the difference between にしては、 わりに and くせに?
What happens when your group is victim of a surprise attack but you can't be surprised?
MH370 blackbox - is it still possible to retrieve data from it?
Was "I have the farts, again" broadcast from the Moon to the whole world?
If protons are the only stable baryons, why do they decay into neutrons in positron emission?
How should I behave to assure my friends that I am not after their money?
Strange result with SED Pattern and Hold space
What does x option for sed do actually when exchanging data between hold and pattern buffer?sed pattern space and hold spaceSED command and filenames with spaceReplacing lines containing a pattern with sedSpace removal after a pattern in SEDSed command with complex pattern and replacementSED Multi-line substitute and hold spaceHow to search for the word stored in the hold space with sed?sed pattern and multiline substitutionsed: !p command strange behavior
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I have the following SED Code, that extracts a username along with their date of birth and displays it on one line. User name and date of birth are are two separate lines.
The issues is that hold buffer is not being over written each time a name is encountered and stored. sometimes it can show about 10 users properly, but sometimes it displays the same name (2 or 3 times). see current results.
sed -rn
-e '/^Name:s(.*)Local:.*/{
s//1/
h
}'
-e '/DOB:/{
s/(.*DOB:s([0-9]{1,2}/[0-9]{1,2}/[0-9]{4}).*)/2/
#s/(.*DOB:s(.*)sMem.*)/2/
G
s/(.*)n(.*)/2t1/
p
}' $f
I thought code above would give me an output similar to:
Current Results
Tito Puente 8/21/1999
Tito Puente 23/13/1967
ARON BYRDMAN 6/24/1320
JOE P. EARTHE 9/7/1961
WISTON P. GREY HEAVEN, NY 10121 DOB: Mem Status: Journeyman
WISTON P. GREY 42/12/1949
Sample Data
I have tried various options to no avail. does any have a clue?
sed
add a comment |
I have the following SED Code, that extracts a username along with their date of birth and displays it on one line. User name and date of birth are are two separate lines.
The issues is that hold buffer is not being over written each time a name is encountered and stored. sometimes it can show about 10 users properly, but sometimes it displays the same name (2 or 3 times). see current results.
sed -rn
-e '/^Name:s(.*)Local:.*/{
s//1/
h
}'
-e '/DOB:/{
s/(.*DOB:s([0-9]{1,2}/[0-9]{1,2}/[0-9]{4}).*)/2/
#s/(.*DOB:s(.*)sMem.*)/2/
G
s/(.*)n(.*)/2t1/
p
}' $f
I thought code above would give me an output similar to:
Current Results
Tito Puente 8/21/1999
Tito Puente 23/13/1967
ARON BYRDMAN 6/24/1320
JOE P. EARTHE 9/7/1961
WISTON P. GREY HEAVEN, NY 10121 DOB: Mem Status: Journeyman
WISTON P. GREY 42/12/1949
Sample Data
I have tried various options to no avail. does any have a clue?
sed
It looks like you're depending onLocalbeing on the same line asName, and that's clearly not the case for all names.
– muru
5 mins ago
add a comment |
I have the following SED Code, that extracts a username along with their date of birth and displays it on one line. User name and date of birth are are two separate lines.
The issues is that hold buffer is not being over written each time a name is encountered and stored. sometimes it can show about 10 users properly, but sometimes it displays the same name (2 or 3 times). see current results.
sed -rn
-e '/^Name:s(.*)Local:.*/{
s//1/
h
}'
-e '/DOB:/{
s/(.*DOB:s([0-9]{1,2}/[0-9]{1,2}/[0-9]{4}).*)/2/
#s/(.*DOB:s(.*)sMem.*)/2/
G
s/(.*)n(.*)/2t1/
p
}' $f
I thought code above would give me an output similar to:
Current Results
Tito Puente 8/21/1999
Tito Puente 23/13/1967
ARON BYRDMAN 6/24/1320
JOE P. EARTHE 9/7/1961
WISTON P. GREY HEAVEN, NY 10121 DOB: Mem Status: Journeyman
WISTON P. GREY 42/12/1949
Sample Data
I have tried various options to no avail. does any have a clue?
sed
I have the following SED Code, that extracts a username along with their date of birth and displays it on one line. User name and date of birth are are two separate lines.
The issues is that hold buffer is not being over written each time a name is encountered and stored. sometimes it can show about 10 users properly, but sometimes it displays the same name (2 or 3 times). see current results.
sed -rn
-e '/^Name:s(.*)Local:.*/{
s//1/
h
}'
-e '/DOB:/{
s/(.*DOB:s([0-9]{1,2}/[0-9]{1,2}/[0-9]{4}).*)/2/
#s/(.*DOB:s(.*)sMem.*)/2/
G
s/(.*)n(.*)/2t1/
p
}' $f
I thought code above would give me an output similar to:
Current Results
Tito Puente 8/21/1999
Tito Puente 23/13/1967
ARON BYRDMAN 6/24/1320
JOE P. EARTHE 9/7/1961
WISTON P. GREY HEAVEN, NY 10121 DOB: Mem Status: Journeyman
WISTON P. GREY 42/12/1949
Sample Data
I have tried various options to no avail. does any have a clue?
sed
sed
edited 8 mins ago
muru
40.1k5 gold badges98 silver badges172 bronze badges
40.1k5 gold badges98 silver badges172 bronze badges
asked 37 mins ago
user68650user68650
1712 silver badges14 bronze badges
1712 silver badges14 bronze badges
It looks like you're depending onLocalbeing on the same line asName, and that's clearly not the case for all names.
– muru
5 mins ago
add a comment |
It looks like you're depending onLocalbeing on the same line asName, and that's clearly not the case for all names.
– muru
5 mins ago
It looks like you're depending on
Local being on the same line as Name, and that's clearly not the case for all names.– muru
5 mins ago
It looks like you're depending on
Local being on the same line as Name, and that's clearly not the case for all names.– muru
5 mins ago
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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%2funix.stackexchange.com%2fquestions%2f526531%2fstrange-result-with-sed-pattern-and-hold-space%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 Unix & Linux Stack Exchange!
- 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%2funix.stackexchange.com%2fquestions%2f526531%2fstrange-result-with-sed-pattern-and-hold-space%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
It looks like you're depending on
Localbeing on the same line asName, and that's clearly not the case for all names.– muru
5 mins ago