How to extract the URL from xml or any text file2019 Community Moderator Electionextract blocks of text from xml filefilter text xml fileHow to extract XML from a text fileextract blocks of text from xml file with a conditionExtract value from XMLExtract arbitrary XML from a text file using sedHow to extract a XML from log fileHow to extract data from XML FileHow to extract the XML from a log entry?extract xml tag value from the file to Variable
How to balance a monster modification (zombie)?
Why didn’t Eve recognize the little cockroach as a living organism?
Why does Surtur say that Thor is Asgard's doom?
Determine voltage drop over 10G resistors with cheap multimeter
Isn't the word "experience" wrongly used in this context?
Friend wants my recommendation but I don't want to
What (if any) is the reason to buy in small local stores?
Knife as defense against stray dogs
When did hardware antialiasing start being available?
Why doesn't the fusion process of the sun speed up?
Is this Pascal's Matrix?
"Marked down as someone wanting to sell shares." What does that mean?
Have the tides ever turned twice on any open problem?
Unfrosted light bulb
Hackerrank All Women's Codesprint 2019: Name the Product
Writing in a Christian voice
How can an organ that provides biological immortality be unable to regenerate?
Why is this tree refusing to shed its dead leaves?
Can a university suspend a student even when he has left university?
Homology of the fiber
How can a new country break out from a developed country without war?
Do native speakers use "ultima" and "proxima" frequently in spoken English?
Jem'Hadar, something strange about their life expectancy
Does convergence of polynomials imply that of its coefficients?
How to extract the URL from xml or any text file
2019 Community Moderator Electionextract blocks of text from xml filefilter text xml fileHow to extract XML from a text fileextract blocks of text from xml file with a conditionExtract value from XMLExtract arbitrary XML from a text file using sedHow to extract a XML from log fileHow to extract data from XML FileHow to extract the XML from a log entry?extract xml tag value from the file to Variable
My XML file;
<settings version="2">
<setting id="TimeShift" default="true">0</setting>
<setting id="Override" default="true">false</setting>
<setting id="Cache">true</setting>
<setting id="Path">/storage/</setting>
<setting id="PathType">0</setting>
<setting id="Url1">http://localhost:8080/main.php?value1=abcd-1234&value2=OqUy1cHm&type=post</setting>
<setting id="startNum">1</setting>
</settings>
I need to extract the variable URL value. I tried some sed and grep commands but don't get result. Which command should I use?
sed grep xml
New contributor
add a comment |
My XML file;
<settings version="2">
<setting id="TimeShift" default="true">0</setting>
<setting id="Override" default="true">false</setting>
<setting id="Cache">true</setting>
<setting id="Path">/storage/</setting>
<setting id="PathType">0</setting>
<setting id="Url1">http://localhost:8080/main.php?value1=abcd-1234&value2=OqUy1cHm&type=post</setting>
<setting id="startNum">1</setting>
</settings>
I need to extract the variable URL value. I tried some sed and grep commands but don't get result. Which command should I use?
sed grep xml
New contributor
add a comment |
My XML file;
<settings version="2">
<setting id="TimeShift" default="true">0</setting>
<setting id="Override" default="true">false</setting>
<setting id="Cache">true</setting>
<setting id="Path">/storage/</setting>
<setting id="PathType">0</setting>
<setting id="Url1">http://localhost:8080/main.php?value1=abcd-1234&value2=OqUy1cHm&type=post</setting>
<setting id="startNum">1</setting>
</settings>
I need to extract the variable URL value. I tried some sed and grep commands but don't get result. Which command should I use?
sed grep xml
New contributor
My XML file;
<settings version="2">
<setting id="TimeShift" default="true">0</setting>
<setting id="Override" default="true">false</setting>
<setting id="Cache">true</setting>
<setting id="Path">/storage/</setting>
<setting id="PathType">0</setting>
<setting id="Url1">http://localhost:8080/main.php?value1=abcd-1234&value2=OqUy1cHm&type=post</setting>
<setting id="startNum">1</setting>
</settings>
I need to extract the variable URL value. I tried some sed and grep commands but don't get result. Which command should I use?
sed grep xml
sed grep xml
New contributor
New contributor
edited 12 hours ago
Kusalananda
136k17257425
136k17257425
New contributor
asked 12 hours ago
Ali Haydar DoğanAli Haydar Doğan
11
11
New contributor
New contributor
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Assuming that the URL is actually encoded properly (it isn't now, which would break some XML parsers; both &
should be &
):
$ xmlstarlet sel -t -v '/settings/setting[@id = "Url1"]' -nl file.xml
http://localhost:8080/main.php?value1=abcd-1234&value2=OqUy1cHm&type=post
This uses xmlstarlet
to fetch the value for the /settings/setting
document node whose id
attribute is Url1
.
Thank you for this valuable information. You are right for (&) character. I did a manual copy-paste of the url for the example.
– Ali Haydar Doğan
7 hours ago
add a comment |
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
);
);
Ali Haydar Doğan is a new contributor. Be nice, and check out our Code of Conduct.
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%2f507003%2fhow-to-extract-the-url-from-xml-or-any-text-file%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Assuming that the URL is actually encoded properly (it isn't now, which would break some XML parsers; both &
should be &
):
$ xmlstarlet sel -t -v '/settings/setting[@id = "Url1"]' -nl file.xml
http://localhost:8080/main.php?value1=abcd-1234&value2=OqUy1cHm&type=post
This uses xmlstarlet
to fetch the value for the /settings/setting
document node whose id
attribute is Url1
.
Thank you for this valuable information. You are right for (&) character. I did a manual copy-paste of the url for the example.
– Ali Haydar Doğan
7 hours ago
add a comment |
Assuming that the URL is actually encoded properly (it isn't now, which would break some XML parsers; both &
should be &
):
$ xmlstarlet sel -t -v '/settings/setting[@id = "Url1"]' -nl file.xml
http://localhost:8080/main.php?value1=abcd-1234&value2=OqUy1cHm&type=post
This uses xmlstarlet
to fetch the value for the /settings/setting
document node whose id
attribute is Url1
.
Thank you for this valuable information. You are right for (&) character. I did a manual copy-paste of the url for the example.
– Ali Haydar Doğan
7 hours ago
add a comment |
Assuming that the URL is actually encoded properly (it isn't now, which would break some XML parsers; both &
should be &
):
$ xmlstarlet sel -t -v '/settings/setting[@id = "Url1"]' -nl file.xml
http://localhost:8080/main.php?value1=abcd-1234&value2=OqUy1cHm&type=post
This uses xmlstarlet
to fetch the value for the /settings/setting
document node whose id
attribute is Url1
.
Assuming that the URL is actually encoded properly (it isn't now, which would break some XML parsers; both &
should be &
):
$ xmlstarlet sel -t -v '/settings/setting[@id = "Url1"]' -nl file.xml
http://localhost:8080/main.php?value1=abcd-1234&value2=OqUy1cHm&type=post
This uses xmlstarlet
to fetch the value for the /settings/setting
document node whose id
attribute is Url1
.
answered 12 hours ago
KusalanandaKusalananda
136k17257425
136k17257425
Thank you for this valuable information. You are right for (&) character. I did a manual copy-paste of the url for the example.
– Ali Haydar Doğan
7 hours ago
add a comment |
Thank you for this valuable information. You are right for (&) character. I did a manual copy-paste of the url for the example.
– Ali Haydar Doğan
7 hours ago
Thank you for this valuable information. You are right for (&) character. I did a manual copy-paste of the url for the example.
– Ali Haydar Doğan
7 hours ago
Thank you for this valuable information. You are right for (&) character. I did a manual copy-paste of the url for the example.
– Ali Haydar Doğan
7 hours ago
add a comment |
Ali Haydar Doğan is a new contributor. Be nice, and check out our Code of Conduct.
Ali Haydar Doğan is a new contributor. Be nice, and check out our Code of Conduct.
Ali Haydar Doğan is a new contributor. Be nice, and check out our Code of Conduct.
Ali Haydar Doğan is a new contributor. Be nice, and check out our Code of Conduct.
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%2f507003%2fhow-to-extract-the-url-from-xml-or-any-text-file%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