Find all the words in a file that contain all four lower-case letters âÂÂinuxâ in order
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
The four letters should be in alphabetical order.
For example, inux
and ianauax
are in the output, but ixnux
and naiauax
are not.
I can only use grep
to accomplish this task.
I tried grep 'iw*nw*uw*xw*'
but i failed because ixnux
is in the output but it shouldn't be in the output (ixnux
is not a word which 'i','n','u','x' are in alphabet order)
grep
add a comment |Â
up vote
1
down vote
favorite
The four letters should be in alphabetical order.
For example, inux
and ianauax
are in the output, but ixnux
and naiauax
are not.
I can only use grep
to accomplish this task.
I tried grep 'iw*nw*uw*xw*'
but i failed because ixnux
is in the output but it shouldn't be in the output (ixnux
is not a word which 'i','n','u','x' are in alphabet order)
grep
3
I wonder if there's some practical application to this, or if this is homework? What about the other letters in between, must they also be in alphabetical order? I.e., isisnux
ok?
â ilkkachu
Jan 31 at 12:33
antineurotoxin Cristineaux fricandeaux influx influxable influxes influxible influxibly influxion influxionism influxious influxive interflux guys...how to make sure all the letters after 'X' are not 'i' 'n' and 'u'?
â Ulysses
Jan 31 at 13:05
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
The four letters should be in alphabetical order.
For example, inux
and ianauax
are in the output, but ixnux
and naiauax
are not.
I can only use grep
to accomplish this task.
I tried grep 'iw*nw*uw*xw*'
but i failed because ixnux
is in the output but it shouldn't be in the output (ixnux
is not a word which 'i','n','u','x' are in alphabet order)
grep
The four letters should be in alphabetical order.
For example, inux
and ianauax
are in the output, but ixnux
and naiauax
are not.
I can only use grep
to accomplish this task.
I tried grep 'iw*nw*uw*xw*'
but i failed because ixnux
is in the output but it shouldn't be in the output (ixnux
is not a word which 'i','n','u','x' are in alphabet order)
grep
edited Jan 31 at 14:05
Tomasz
8,04052560
8,04052560
asked Jan 31 at 12:26
Ulysses
496
496
3
I wonder if there's some practical application to this, or if this is homework? What about the other letters in between, must they also be in alphabetical order? I.e., isisnux
ok?
â ilkkachu
Jan 31 at 12:33
antineurotoxin Cristineaux fricandeaux influx influxable influxes influxible influxibly influxion influxionism influxious influxive interflux guys...how to make sure all the letters after 'X' are not 'i' 'n' and 'u'?
â Ulysses
Jan 31 at 13:05
add a comment |Â
3
I wonder if there's some practical application to this, or if this is homework? What about the other letters in between, must they also be in alphabetical order? I.e., isisnux
ok?
â ilkkachu
Jan 31 at 12:33
antineurotoxin Cristineaux fricandeaux influx influxable influxes influxible influxibly influxion influxionism influxious influxive interflux guys...how to make sure all the letters after 'X' are not 'i' 'n' and 'u'?
â Ulysses
Jan 31 at 13:05
3
3
I wonder if there's some practical application to this, or if this is homework? What about the other letters in between, must they also be in alphabetical order? I.e., is
isnux
ok?â ilkkachu
Jan 31 at 12:33
I wonder if there's some practical application to this, or if this is homework? What about the other letters in between, must they also be in alphabetical order? I.e., is
isnux
ok?â ilkkachu
Jan 31 at 12:33
antineurotoxin Cristineaux fricandeaux influx influxable influxes influxible influxibly influxion influxionism influxious influxive interflux guys...how to make sure all the letters after 'X' are not 'i' 'n' and 'u'?
â Ulysses
Jan 31 at 13:05
antineurotoxin Cristineaux fricandeaux influx influxable influxes influxible influxibly influxion influxionism influxious influxive interflux guys...how to make sure all the letters after 'X' are not 'i' 'n' and 'u'?
â Ulysses
Jan 31 at 13:05
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
0
down vote
accepted
Another grep
approach.
grep '[^nux]*i[^iux]*n[^inx]*u[^unu]*x' infile
Yeah I tried this way but I use [!] in the wildcard and I was wrong :(
â Ulysses
Jan 31 at 12:42
@ñÃÂsýù÷, nope, try thisgrep '[^nux]*i[^iux]*n[^inx]*u[^unu]*x' <<<"###i nt u--x aaa"
- no words here
â RomanPerekhrest
Jan 31 at 12:42
@Ulysses in regular expression^
means all but not including these
â Ã±ÃÂsýù÷
Jan 31 at 12:44
@RomanPerekhrest Yes, but then I doubt for this OP's comment!
â Ã±ÃÂsýù÷
Jan 31 at 12:51
yeah I finally understand it. Thanks. And then I add [^inux] right after *x because if not, then influxible is still in the output lol. Thanks so much
â Ulysses
Jan 31 at 12:53
 |Â
show 1 more comment
up vote
0
down vote
grep
solution:
s="inux and ianauax are in the output, but ixnux and naiauax are not."
grep -o 'b[a-h0-9_]*i[a-l0-9_]*n[a-t0-9_]*u[a-y0-9_]*xw*b' <<<"$s"
The output:
inux
ianauax
The Wisdom! You the best!
â Ulysses
Jan 31 at 12:36
@Ulysses, thanks ...
â RomanPerekhrest
Jan 31 at 12:36
in the wildcard, can I just say 'b[!nux]*i[!iux]*n[!inx]*u[!inu]*xw*b' ?because the word might contains some symbols
â Ulysses
Jan 31 at 12:40
@Ulysses, the "word" here is[a-Z0-9_]
chars only
â RomanPerekhrest
Jan 31 at 12:48
What aboutinuxi
?
â Tomasz
Jan 31 at 14:10
 |Â
show 4 more comments
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
Another grep
approach.
grep '[^nux]*i[^iux]*n[^inx]*u[^unu]*x' infile
Yeah I tried this way but I use [!] in the wildcard and I was wrong :(
â Ulysses
Jan 31 at 12:42
@ñÃÂsýù÷, nope, try thisgrep '[^nux]*i[^iux]*n[^inx]*u[^unu]*x' <<<"###i nt u--x aaa"
- no words here
â RomanPerekhrest
Jan 31 at 12:42
@Ulysses in regular expression^
means all but not including these
â Ã±ÃÂsýù÷
Jan 31 at 12:44
@RomanPerekhrest Yes, but then I doubt for this OP's comment!
â Ã±ÃÂsýù÷
Jan 31 at 12:51
yeah I finally understand it. Thanks. And then I add [^inux] right after *x because if not, then influxible is still in the output lol. Thanks so much
â Ulysses
Jan 31 at 12:53
 |Â
show 1 more comment
up vote
0
down vote
accepted
Another grep
approach.
grep '[^nux]*i[^iux]*n[^inx]*u[^unu]*x' infile
Yeah I tried this way but I use [!] in the wildcard and I was wrong :(
â Ulysses
Jan 31 at 12:42
@ñÃÂsýù÷, nope, try thisgrep '[^nux]*i[^iux]*n[^inx]*u[^unu]*x' <<<"###i nt u--x aaa"
- no words here
â RomanPerekhrest
Jan 31 at 12:42
@Ulysses in regular expression^
means all but not including these
â Ã±ÃÂsýù÷
Jan 31 at 12:44
@RomanPerekhrest Yes, but then I doubt for this OP's comment!
â Ã±ÃÂsýù÷
Jan 31 at 12:51
yeah I finally understand it. Thanks. And then I add [^inux] right after *x because if not, then influxible is still in the output lol. Thanks so much
â Ulysses
Jan 31 at 12:53
 |Â
show 1 more comment
up vote
0
down vote
accepted
up vote
0
down vote
accepted
Another grep
approach.
grep '[^nux]*i[^iux]*n[^inx]*u[^unu]*x' infile
Another grep
approach.
grep '[^nux]*i[^iux]*n[^inx]*u[^unu]*x' infile
answered Jan 31 at 12:38
ñÃÂsýù÷
15k82462
15k82462
Yeah I tried this way but I use [!] in the wildcard and I was wrong :(
â Ulysses
Jan 31 at 12:42
@ñÃÂsýù÷, nope, try thisgrep '[^nux]*i[^iux]*n[^inx]*u[^unu]*x' <<<"###i nt u--x aaa"
- no words here
â RomanPerekhrest
Jan 31 at 12:42
@Ulysses in regular expression^
means all but not including these
â Ã±ÃÂsýù÷
Jan 31 at 12:44
@RomanPerekhrest Yes, but then I doubt for this OP's comment!
â Ã±ÃÂsýù÷
Jan 31 at 12:51
yeah I finally understand it. Thanks. And then I add [^inux] right after *x because if not, then influxible is still in the output lol. Thanks so much
â Ulysses
Jan 31 at 12:53
 |Â
show 1 more comment
Yeah I tried this way but I use [!] in the wildcard and I was wrong :(
â Ulysses
Jan 31 at 12:42
@ñÃÂsýù÷, nope, try thisgrep '[^nux]*i[^iux]*n[^inx]*u[^unu]*x' <<<"###i nt u--x aaa"
- no words here
â RomanPerekhrest
Jan 31 at 12:42
@Ulysses in regular expression^
means all but not including these
â Ã±ÃÂsýù÷
Jan 31 at 12:44
@RomanPerekhrest Yes, but then I doubt for this OP's comment!
â Ã±ÃÂsýù÷
Jan 31 at 12:51
yeah I finally understand it. Thanks. And then I add [^inux] right after *x because if not, then influxible is still in the output lol. Thanks so much
â Ulysses
Jan 31 at 12:53
Yeah I tried this way but I use [!] in the wildcard and I was wrong :(
â Ulysses
Jan 31 at 12:42
Yeah I tried this way but I use [!] in the wildcard and I was wrong :(
â Ulysses
Jan 31 at 12:42
@ñÃÂsýù÷, nope, try this
grep '[^nux]*i[^iux]*n[^inx]*u[^unu]*x' <<<"###i nt u--x aaa"
- no words hereâ RomanPerekhrest
Jan 31 at 12:42
@ñÃÂsýù÷, nope, try this
grep '[^nux]*i[^iux]*n[^inx]*u[^unu]*x' <<<"###i nt u--x aaa"
- no words hereâ RomanPerekhrest
Jan 31 at 12:42
@Ulysses in regular expression
^
means all but not including theseâ Ã±ÃÂsýù÷
Jan 31 at 12:44
@Ulysses in regular expression
^
means all but not including theseâ Ã±ÃÂsýù÷
Jan 31 at 12:44
@RomanPerekhrest Yes, but then I doubt for this OP's comment!
â Ã±ÃÂsýù÷
Jan 31 at 12:51
@RomanPerekhrest Yes, but then I doubt for this OP's comment!
â Ã±ÃÂsýù÷
Jan 31 at 12:51
yeah I finally understand it. Thanks. And then I add [^inux] right after *x because if not, then influxible is still in the output lol. Thanks so much
â Ulysses
Jan 31 at 12:53
yeah I finally understand it. Thanks. And then I add [^inux] right after *x because if not, then influxible is still in the output lol. Thanks so much
â Ulysses
Jan 31 at 12:53
 |Â
show 1 more comment
up vote
0
down vote
grep
solution:
s="inux and ianauax are in the output, but ixnux and naiauax are not."
grep -o 'b[a-h0-9_]*i[a-l0-9_]*n[a-t0-9_]*u[a-y0-9_]*xw*b' <<<"$s"
The output:
inux
ianauax
The Wisdom! You the best!
â Ulysses
Jan 31 at 12:36
@Ulysses, thanks ...
â RomanPerekhrest
Jan 31 at 12:36
in the wildcard, can I just say 'b[!nux]*i[!iux]*n[!inx]*u[!inu]*xw*b' ?because the word might contains some symbols
â Ulysses
Jan 31 at 12:40
@Ulysses, the "word" here is[a-Z0-9_]
chars only
â RomanPerekhrest
Jan 31 at 12:48
What aboutinuxi
?
â Tomasz
Jan 31 at 14:10
 |Â
show 4 more comments
up vote
0
down vote
grep
solution:
s="inux and ianauax are in the output, but ixnux and naiauax are not."
grep -o 'b[a-h0-9_]*i[a-l0-9_]*n[a-t0-9_]*u[a-y0-9_]*xw*b' <<<"$s"
The output:
inux
ianauax
The Wisdom! You the best!
â Ulysses
Jan 31 at 12:36
@Ulysses, thanks ...
â RomanPerekhrest
Jan 31 at 12:36
in the wildcard, can I just say 'b[!nux]*i[!iux]*n[!inx]*u[!inu]*xw*b' ?because the word might contains some symbols
â Ulysses
Jan 31 at 12:40
@Ulysses, the "word" here is[a-Z0-9_]
chars only
â RomanPerekhrest
Jan 31 at 12:48
What aboutinuxi
?
â Tomasz
Jan 31 at 14:10
 |Â
show 4 more comments
up vote
0
down vote
up vote
0
down vote
grep
solution:
s="inux and ianauax are in the output, but ixnux and naiauax are not."
grep -o 'b[a-h0-9_]*i[a-l0-9_]*n[a-t0-9_]*u[a-y0-9_]*xw*b' <<<"$s"
The output:
inux
ianauax
grep
solution:
s="inux and ianauax are in the output, but ixnux and naiauax are not."
grep -o 'b[a-h0-9_]*i[a-l0-9_]*n[a-t0-9_]*u[a-y0-9_]*xw*b' <<<"$s"
The output:
inux
ianauax
answered Jan 31 at 12:32
RomanPerekhrest
22.4k12144
22.4k12144
The Wisdom! You the best!
â Ulysses
Jan 31 at 12:36
@Ulysses, thanks ...
â RomanPerekhrest
Jan 31 at 12:36
in the wildcard, can I just say 'b[!nux]*i[!iux]*n[!inx]*u[!inu]*xw*b' ?because the word might contains some symbols
â Ulysses
Jan 31 at 12:40
@Ulysses, the "word" here is[a-Z0-9_]
chars only
â RomanPerekhrest
Jan 31 at 12:48
What aboutinuxi
?
â Tomasz
Jan 31 at 14:10
 |Â
show 4 more comments
The Wisdom! You the best!
â Ulysses
Jan 31 at 12:36
@Ulysses, thanks ...
â RomanPerekhrest
Jan 31 at 12:36
in the wildcard, can I just say 'b[!nux]*i[!iux]*n[!inx]*u[!inu]*xw*b' ?because the word might contains some symbols
â Ulysses
Jan 31 at 12:40
@Ulysses, the "word" here is[a-Z0-9_]
chars only
â RomanPerekhrest
Jan 31 at 12:48
What aboutinuxi
?
â Tomasz
Jan 31 at 14:10
The Wisdom! You the best!
â Ulysses
Jan 31 at 12:36
The Wisdom! You the best!
â Ulysses
Jan 31 at 12:36
@Ulysses, thanks ...
â RomanPerekhrest
Jan 31 at 12:36
@Ulysses, thanks ...
â RomanPerekhrest
Jan 31 at 12:36
in the wildcard, can I just say 'b[!nux]*i[!iux]*n[!inx]*u[!inu]*xw*b' ?because the word might contains some symbols
â Ulysses
Jan 31 at 12:40
in the wildcard, can I just say 'b[!nux]*i[!iux]*n[!inx]*u[!inu]*xw*b' ?because the word might contains some symbols
â Ulysses
Jan 31 at 12:40
@Ulysses, the "word" here is
[a-Z0-9_]
chars onlyâ RomanPerekhrest
Jan 31 at 12:48
@Ulysses, the "word" here is
[a-Z0-9_]
chars onlyâ RomanPerekhrest
Jan 31 at 12:48
What about
inuxi
?â Tomasz
Jan 31 at 14:10
What about
inuxi
?â Tomasz
Jan 31 at 14:10
 |Â
show 4 more comments
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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f420934%2ffind-all-the-words-in-a-file-that-contain-all-four-lower-case-letters-inux-in%23new-answer', 'question_page');
);
Post as a guest
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
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
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
3
I wonder if there's some practical application to this, or if this is homework? What about the other letters in between, must they also be in alphabetical order? I.e., is
isnux
ok?â ilkkachu
Jan 31 at 12:33
antineurotoxin Cristineaux fricandeaux influx influxable influxes influxible influxibly influxion influxionism influxious influxive interflux guys...how to make sure all the letters after 'X' are not 'i' 'n' and 'u'?
â Ulysses
Jan 31 at 13:05