Printing Characters after a ColonHow to use Sed to replace all characters before colon?How to include...
What happens when redirecting with 3>&1 1>/dev/null?
nginx conf: http2 module not working in Chrome in ubuntu 18.04
Is it normal to "extract a paper" from a master thesis?
size of pointers and architecture
Negative impact of having the launch pad away from the Equator
Why is this integration method not valid?
Why is a weak base more able to deprotonate a strong acid than a weak acid?
Why do testers need root cause analysis?
Caught with my phone during an exam
Is it safe to redirect stdout and stderr to the same file without file descriptor copies?
Computing elements of a 1000 x 60 matrix exhausts RAM
Salesforce bug enabled "Modify All"
Wifi light switch needs neutral wire. Why? AND Can that wire be a skinny one?
How to become an Editorial board member?
Is a world with one country feeding everyone possible?
Is there a word for pant sleeves?
mmap: effect of other processes writing to a file previously mapped read-only
Which values for voltage divider
VHDL: Why is it hard to desgin a floating point unit in hardware?
Illustrating that universal optimality is stronger than sphere packing
Are there any tips to help hummingbirds find a new feeder?
How do I write real-world stories separate from my country of origin?
Managing heat dissipation in a magic wand
What pc resources are used when bruteforcing?
Printing Characters after a Colon
How to use Sed to replace all characters before colon?How to include everything before Colon in Sed/Grep/…?sed: adding space around colonOutput only certain fieldsReplace special characters in specific fieldPrint match and line afteredit comma seperated fields and grep specific field bigger than my conditionPrinting columns using AWK?Extract substring after delimiter using GNU awk or awkPrinting one column from one file - awk
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
How do I print anything after the colon?
Input:
color:white,name:green
so I would like to print anything after :
Output:
white,green
awk sed regular-expression cut
add a comment |
How do I print anything after the colon?
Input:
color:white,name:green
so I would like to print anything after :
Output:
white,green
awk sed regular-expression cut
add a comment |
How do I print anything after the colon?
Input:
color:white,name:green
so I would like to print anything after :
Output:
white,green
awk sed regular-expression cut
How do I print anything after the colon?
Input:
color:white,name:green
so I would like to print anything after :
Output:
white,green
awk sed regular-expression cut
awk sed regular-expression cut
edited Dec 20 '17 at 10:25
Kevdog777
2,122123461
2,122123461
asked Dec 20 '17 at 9:42
αԋɱҽԃ αмєяιcαηαԋɱҽԃ αмєяιcαη
5022725
5022725
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
Simple sed
approach (while your input is pretty simple):
sed 's/[^,:]*://g' file
The output:
white,green
add a comment |
You can also do this with grep
:
GNU grep
grep -oP '(?<=:)w+'
Portable grep
grep -o ':[a-z]+' | tr -d :
Output in both cases
white
green
Note about output
If you want the output as a comma-separated list, pipe to paste
, e.g.:
grep -o ':[a-z]+' | tr -d : | paste -sd, -
Output:
white,green
add a comment |
Using awk
awk -F':' '{print $2}'
The statement of the question is vague, but if you look at the sample data, you’ll see that this answer is wrong.
– G-Man
31 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%2f412003%2fprinting-characters-after-a-colon%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Simple sed
approach (while your input is pretty simple):
sed 's/[^,:]*://g' file
The output:
white,green
add a comment |
Simple sed
approach (while your input is pretty simple):
sed 's/[^,:]*://g' file
The output:
white,green
add a comment |
Simple sed
approach (while your input is pretty simple):
sed 's/[^,:]*://g' file
The output:
white,green
Simple sed
approach (while your input is pretty simple):
sed 's/[^,:]*://g' file
The output:
white,green
answered Dec 20 '17 at 9:45
RomanPerekhrestRomanPerekhrest
23.4k12548
23.4k12548
add a comment |
add a comment |
You can also do this with grep
:
GNU grep
grep -oP '(?<=:)w+'
Portable grep
grep -o ':[a-z]+' | tr -d :
Output in both cases
white
green
Note about output
If you want the output as a comma-separated list, pipe to paste
, e.g.:
grep -o ':[a-z]+' | tr -d : | paste -sd, -
Output:
white,green
add a comment |
You can also do this with grep
:
GNU grep
grep -oP '(?<=:)w+'
Portable grep
grep -o ':[a-z]+' | tr -d :
Output in both cases
white
green
Note about output
If you want the output as a comma-separated list, pipe to paste
, e.g.:
grep -o ':[a-z]+' | tr -d : | paste -sd, -
Output:
white,green
add a comment |
You can also do this with grep
:
GNU grep
grep -oP '(?<=:)w+'
Portable grep
grep -o ':[a-z]+' | tr -d :
Output in both cases
white
green
Note about output
If you want the output as a comma-separated list, pipe to paste
, e.g.:
grep -o ':[a-z]+' | tr -d : | paste -sd, -
Output:
white,green
You can also do this with grep
:
GNU grep
grep -oP '(?<=:)w+'
Portable grep
grep -o ':[a-z]+' | tr -d :
Output in both cases
white
green
Note about output
If you want the output as a comma-separated list, pipe to paste
, e.g.:
grep -o ':[a-z]+' | tr -d : | paste -sd, -
Output:
white,green
answered Dec 20 '17 at 15:48
ThorThor
12.4k13963
12.4k13963
add a comment |
add a comment |
Using awk
awk -F':' '{print $2}'
The statement of the question is vague, but if you look at the sample data, you’ll see that this answer is wrong.
– G-Man
31 mins ago
add a comment |
Using awk
awk -F':' '{print $2}'
The statement of the question is vague, but if you look at the sample data, you’ll see that this answer is wrong.
– G-Man
31 mins ago
add a comment |
Using awk
awk -F':' '{print $2}'
Using awk
awk -F':' '{print $2}'
answered 53 mins ago
SuppboiSuppboi
14
14
The statement of the question is vague, but if you look at the sample data, you’ll see that this answer is wrong.
– G-Man
31 mins ago
add a comment |
The statement of the question is vague, but if you look at the sample data, you’ll see that this answer is wrong.
– G-Man
31 mins ago
The statement of the question is vague, but if you look at the sample data, you’ll see that this answer is wrong.
– G-Man
31 mins ago
The statement of the question is vague, but if you look at the sample data, you’ll see that this answer is wrong.
– G-Man
31 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%2f412003%2fprinting-characters-after-a-colon%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