Grep complete name including dot in the wordlocally created alias not being used if called using backticks...
Is it possible to kill all life on Earth?
Modern approach to radio buttons
What does it mean when you think without speaking?
How to properly maintain eye contact with people that have distinctive facial features?
My player wants to cast multiple charges of magic missile from a wand
Could I be denied entry into Ireland due to medical and police situations during a previous UK visit?
What is the difference between nullifying your vote and not going to vote at all?
Can a wire having a 610-670 THz (frequency of blue light) AC frequency supply, generate blue light?
Do Multiclassed spellcasters add their ability modifier or proficiency bonus twice when determining spell save DC?
What's the most polite way to tell a manager "shut up and let me work"?
Do creatures all have the same statistics upon being reanimated via the Animate Dead spell?
How can a single Member of the House block a Congressional bill?
Where did the “vikings wear helmets with horn” stereotype come from and why?
What was this black-and-white film set in the Arctic or Antarctic where the monster/alien gets fried in the end?
Could IPv6 make NAT / port numbers redundant?
Strange math syntax in old basic listing
What to do if opponent has poor hygiene?
Can an old DSLR be upgraded to match modern smartphone image quality
What does "Marchentalender" on the front of a postcard mean?
How did early x86 BIOS programmers manage to program full blown TUIs given very few bytes of ROM/EPROM?
Possible nonclassical ion from a bicyclic system
Is having a hidden directory under /etc safe?
Where can I find the list of all tendons in the human body?
Thousands and thousands of words
Grep complete name including dot in the word
locally created alias not being used if called using backticks (`)How to parse table for pattern if pattern includes spacespassing the results of awk command as a parameterProblem with grep -oIf condition not working in script over sshHow to find a file matching a specific pattern and date while copying every found file to another web server's directory?Remove specific columns from csv using awkGet the xml nodes where the search text is foundReplace counter field in large file with iterated valueBrowse directory and extract word from folder name
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
In a ksh
shell script I am using a grep
command to get a specific word as shown below.
$ cat file.txt
abc xyzdef.123 def.jkl mnopqrst
$ grep -o "wdefw" file.txt
xyzdef
def
I want output to be xyzdef.123
and def.jkl
It is not fetching the value after .
Is there any other way to grep
this word also I don't know the exact word to grep
only I know a pattern. I am working on ksh
shell.
shell-script
add a comment |
In a ksh
shell script I am using a grep
command to get a specific word as shown below.
$ cat file.txt
abc xyzdef.123 def.jkl mnopqrst
$ grep -o "wdefw" file.txt
xyzdef
def
I want output to be xyzdef.123
and def.jkl
It is not fetching the value after .
Is there any other way to grep
this word also I don't know the exact word to grep
only I know a pattern. I am working on ksh
shell.
shell-script
add a comment |
In a ksh
shell script I am using a grep
command to get a specific word as shown below.
$ cat file.txt
abc xyzdef.123 def.jkl mnopqrst
$ grep -o "wdefw" file.txt
xyzdef
def
I want output to be xyzdef.123
and def.jkl
It is not fetching the value after .
Is there any other way to grep
this word also I don't know the exact word to grep
only I know a pattern. I am working on ksh
shell.
shell-script
In a ksh
shell script I am using a grep
command to get a specific word as shown below.
$ cat file.txt
abc xyzdef.123 def.jkl mnopqrst
$ grep -o "wdefw" file.txt
xyzdef
def
I want output to be xyzdef.123
and def.jkl
It is not fetching the value after .
Is there any other way to grep
this word also I don't know the exact word to grep
only I know a pattern. I am working on ksh
shell.
shell-script
shell-script
edited 1 hour ago
Inian
6,1901633
6,1901633
asked 1 hour ago
ArnavArnav
112
112
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
With the attempt you have, you can't match the whole word to be returned. The -o
flag of grep
only returns the matched regex portion defined. Also w
is not a POSIX defined extension for grep
and might be available only in the GNU versions which support the PCRE syntax. On which you could do
grep -oP '(w*)def[.](w*)'
The -P
flag turns on the PCRE regex mode in GNU grep
and the -o
flag returns the whole word matched the regex defined. The regex is translated as match zero or more number of alphanumeric characters followed by def
and a literal .
( enclosed in a bracket expression ) and followed by zero or more number of alphanumeric characters.
Using POSIX character classes for alphanumeric characters would be doing below. But remember the flag -o
is still a GNU extension
grep -o '([[:alnum:]]*)def[.]([[:alnum:]]*)'
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%2f521663%2fgrep-complete-name-including-dot-in-the-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
With the attempt you have, you can't match the whole word to be returned. The -o
flag of grep
only returns the matched regex portion defined. Also w
is not a POSIX defined extension for grep
and might be available only in the GNU versions which support the PCRE syntax. On which you could do
grep -oP '(w*)def[.](w*)'
The -P
flag turns on the PCRE regex mode in GNU grep
and the -o
flag returns the whole word matched the regex defined. The regex is translated as match zero or more number of alphanumeric characters followed by def
and a literal .
( enclosed in a bracket expression ) and followed by zero or more number of alphanumeric characters.
Using POSIX character classes for alphanumeric characters would be doing below. But remember the flag -o
is still a GNU extension
grep -o '([[:alnum:]]*)def[.]([[:alnum:]]*)'
add a comment |
With the attempt you have, you can't match the whole word to be returned. The -o
flag of grep
only returns the matched regex portion defined. Also w
is not a POSIX defined extension for grep
and might be available only in the GNU versions which support the PCRE syntax. On which you could do
grep -oP '(w*)def[.](w*)'
The -P
flag turns on the PCRE regex mode in GNU grep
and the -o
flag returns the whole word matched the regex defined. The regex is translated as match zero or more number of alphanumeric characters followed by def
and a literal .
( enclosed in a bracket expression ) and followed by zero or more number of alphanumeric characters.
Using POSIX character classes for alphanumeric characters would be doing below. But remember the flag -o
is still a GNU extension
grep -o '([[:alnum:]]*)def[.]([[:alnum:]]*)'
add a comment |
With the attempt you have, you can't match the whole word to be returned. The -o
flag of grep
only returns the matched regex portion defined. Also w
is not a POSIX defined extension for grep
and might be available only in the GNU versions which support the PCRE syntax. On which you could do
grep -oP '(w*)def[.](w*)'
The -P
flag turns on the PCRE regex mode in GNU grep
and the -o
flag returns the whole word matched the regex defined. The regex is translated as match zero or more number of alphanumeric characters followed by def
and a literal .
( enclosed in a bracket expression ) and followed by zero or more number of alphanumeric characters.
Using POSIX character classes for alphanumeric characters would be doing below. But remember the flag -o
is still a GNU extension
grep -o '([[:alnum:]]*)def[.]([[:alnum:]]*)'
With the attempt you have, you can't match the whole word to be returned. The -o
flag of grep
only returns the matched regex portion defined. Also w
is not a POSIX defined extension for grep
and might be available only in the GNU versions which support the PCRE syntax. On which you could do
grep -oP '(w*)def[.](w*)'
The -P
flag turns on the PCRE regex mode in GNU grep
and the -o
flag returns the whole word matched the regex defined. The regex is translated as match zero or more number of alphanumeric characters followed by def
and a literal .
( enclosed in a bracket expression ) and followed by zero or more number of alphanumeric characters.
Using POSIX character classes for alphanumeric characters would be doing below. But remember the flag -o
is still a GNU extension
grep -o '([[:alnum:]]*)def[.]([[:alnum:]]*)'
edited 53 mins ago
answered 1 hour ago
InianInian
6,1901633
6,1901633
add a comment |
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%2f521663%2fgrep-complete-name-including-dot-in-the-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