Remove n character after specific wordRemove string from a particular field using awk/sedRemove ^M character...
Why did Steve Rogers choose this character in Endgame?
Strategy to pay off revolving debt while building reserve savings fund?
What details should I consider before agreeing for part of my salary to be 'retained' by employer?
Why is Katakana not pronounced Katagana?
Mechanical puzzle ID: Ring, barbell, and four-holed panel
Cine footage fron Saturn V launch's
How can I find what program is preventing my Mac from going to sleep?
Credit card details stolen every 1-2 years. What am I doing wrong?
Manually select/unselect lines before forwarding to stdout
Why did Spider-Man take a detour to Dorset?
How to delete certain lists from a nested list?
Did 007 exist before James Bond?
Is it OK to use personal email ID for faculty job applications or should we use (current) institute's ID
Do I need a 50/60Hz notch filter for battery powered devices?
Why doesn't philosophy have higher standards for its arguments?
What happens if there is no space for entry stamp in the passport for US visa?
Is it rude to refer to janitors as 'floor people'?
Unix chat server making communication between terminals possible
What powers the air required for pneumatic brakes in aircraft?
How Can I Process Untrusted Data Sources Securely?
Did Voldemort kill his father before finding out about Horcruxes?
Trivial cases of shared_ptr and weak_ptr failing
How can I leave a car for someone if we can't meet in person?
Why do so many pure math PhD students drop out or leave academia, compared to applied mathematics PhDs?
Remove n character after specific word
Remove string from a particular field using awk/sedRemove ^M character from log filesCanot remove symlinks: after reboot, symlinks re-appearHow to remove certain characters (but not all) before one or more character(s)?Remove leading 0 from specific fieldHow to remove the comma and print the entire row again for the words which are place after the commaRemove the multiple comma's from specific column of tab delimited fileand print the words on new lineHow can I remove certain string from file name?Compare two columns and insert value to next columnAwk to remove extra space after first letter?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
MY Data:
7468656.xml-87-
7468656.xml-88-
7468656.xml-89-
7468656.xml-90-
7468656.xml-91-
7468656.xml-92-
7468656.xml-93-
7468656.xml:94:
7468656.xml-115-
7468656.xml-116-
7468656.xml-117-
7468656.xml-118-
7468656.xml-119-
7468656.xml-120-
7468656.xml-121-
7468656.xml:122:
Desired output: Remove 5 character after ".xml"
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
Command tried:
awk '{gsub(/[.xml ]/,"",$1)}9' File
only ".xml" removed from file.
linux shell awk
add a comment |
MY Data:
7468656.xml-87-
7468656.xml-88-
7468656.xml-89-
7468656.xml-90-
7468656.xml-91-
7468656.xml-92-
7468656.xml-93-
7468656.xml:94:
7468656.xml-115-
7468656.xml-116-
7468656.xml-117-
7468656.xml-118-
7468656.xml-119-
7468656.xml-120-
7468656.xml-121-
7468656.xml:122:
Desired output: Remove 5 character after ".xml"
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
Command tried:
awk '{gsub(/[.xml ]/,"",$1)}9' File
only ".xml" removed from file.
linux shell awk
add a comment |
MY Data:
7468656.xml-87-
7468656.xml-88-
7468656.xml-89-
7468656.xml-90-
7468656.xml-91-
7468656.xml-92-
7468656.xml-93-
7468656.xml:94:
7468656.xml-115-
7468656.xml-116-
7468656.xml-117-
7468656.xml-118-
7468656.xml-119-
7468656.xml-120-
7468656.xml-121-
7468656.xml:122:
Desired output: Remove 5 character after ".xml"
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
Command tried:
awk '{gsub(/[.xml ]/,"",$1)}9' File
only ".xml" removed from file.
linux shell awk
MY Data:
7468656.xml-87-
7468656.xml-88-
7468656.xml-89-
7468656.xml-90-
7468656.xml-91-
7468656.xml-92-
7468656.xml-93-
7468656.xml:94:
7468656.xml-115-
7468656.xml-116-
7468656.xml-117-
7468656.xml-118-
7468656.xml-119-
7468656.xml-120-
7468656.xml-121-
7468656.xml:122:
Desired output: Remove 5 character after ".xml"
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
7468656
Command tried:
awk '{gsub(/[.xml ]/,"",$1)}9' File
only ".xml" removed from file.
linux shell awk
linux shell awk
edited 1 hour ago
msp9011
5,3095 gold badges42 silver badges69 bronze badges
5,3095 gold badges42 silver badges69 bronze badges
asked 1 hour ago
Vivek NigamVivek Nigam
232 silver badges9 bronze badges
232 silver badges9 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Try this,
awk -F '[.]xml' '{print $1}' file
or in your way...
awk '{gsub(/.xml.*/,"",$1)}9' file
Quick resolution , worked , solved
– Vivek Nigam
52 mins ago
2
Alsoawk '{ sub(/[-:].*/,"") }1' file
– Inian
47 mins 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
});
}
});
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%2f530556%2fremove-n-character-after-specific-word%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
Try this,
awk -F '[.]xml' '{print $1}' file
or in your way...
awk '{gsub(/.xml.*/,"",$1)}9' file
Quick resolution , worked , solved
– Vivek Nigam
52 mins ago
2
Alsoawk '{ sub(/[-:].*/,"") }1' file
– Inian
47 mins ago
add a comment |
Try this,
awk -F '[.]xml' '{print $1}' file
or in your way...
awk '{gsub(/.xml.*/,"",$1)}9' file
Quick resolution , worked , solved
– Vivek Nigam
52 mins ago
2
Alsoawk '{ sub(/[-:].*/,"") }1' file
– Inian
47 mins ago
add a comment |
Try this,
awk -F '[.]xml' '{print $1}' file
or in your way...
awk '{gsub(/.xml.*/,"",$1)}9' file
Try this,
awk -F '[.]xml' '{print $1}' file
or in your way...
awk '{gsub(/.xml.*/,"",$1)}9' file
answered 1 hour ago
msp9011msp9011
5,3095 gold badges42 silver badges69 bronze badges
5,3095 gold badges42 silver badges69 bronze badges
Quick resolution , worked , solved
– Vivek Nigam
52 mins ago
2
Alsoawk '{ sub(/[-:].*/,"") }1' file
– Inian
47 mins ago
add a comment |
Quick resolution , worked , solved
– Vivek Nigam
52 mins ago
2
Alsoawk '{ sub(/[-:].*/,"") }1' file
– Inian
47 mins ago
Quick resolution , worked , solved
– Vivek Nigam
52 mins ago
Quick resolution , worked , solved
– Vivek Nigam
52 mins ago
2
2
Also
awk '{ sub(/[-:].*/,"") }1' file
– Inian
47 mins ago
Also
awk '{ sub(/[-:].*/,"") }1' file
– Inian
47 mins ago
add a comment |
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%2f530556%2fremove-n-character-after-specific-word%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