Display lines when the digits repeated in same line

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I would like to display the lines on text if 3 digits repeated in same line
with a condition applied for 3 digits repeat.
Input
410202410
203103903
555710294473555
so 410 and 555 repeated
Output
410202410
555710294473555
how to handle this through sed or awk?
And kindly advise in case if i would like to apply the same only on digits before first comma
such as 410202410,11,2017,109
linux awk sed grep regular-expression
add a comment |Â
up vote
0
down vote
favorite
I would like to display the lines on text if 3 digits repeated in same line
with a condition applied for 3 digits repeat.
Input
410202410
203103903
555710294473555
so 410 and 555 repeated
Output
410202410
555710294473555
how to handle this through sed or awk?
And kindly advise in case if i would like to apply the same only on digits before first comma
such as 410202410,11,2017,109
linux awk sed grep regular-expression
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I would like to display the lines on text if 3 digits repeated in same line
with a condition applied for 3 digits repeat.
Input
410202410
203103903
555710294473555
so 410 and 555 repeated
Output
410202410
555710294473555
how to handle this through sed or awk?
And kindly advise in case if i would like to apply the same only on digits before first comma
such as 410202410,11,2017,109
linux awk sed grep regular-expression
I would like to display the lines on text if 3 digits repeated in same line
with a condition applied for 3 digits repeat.
Input
410202410
203103903
555710294473555
so 410 and 555 repeated
Output
410202410
555710294473555
how to handle this through sed or awk?
And kindly advise in case if i would like to apply the same only on digits before first comma
such as 410202410,11,2017,109
linux awk sed grep regular-expression
edited Dec 15 '17 at 22:13
asked Dec 15 '17 at 21:38
ñÃÂñýàñüÃÂÃÂùcñ÷
412418
412418
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
POSIXly:
grep '([0-9]3).*1'
Would print the lines that contain 3 decimal digits followed by a sequence of 0 or more characters followed by the same 3 digits.
To restrict that pattern before the first comma:
grep '^[^,]*([0-9]3)[^,]*1'
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
POSIXly:
grep '([0-9]3).*1'
Would print the lines that contain 3 decimal digits followed by a sequence of 0 or more characters followed by the same 3 digits.
To restrict that pattern before the first comma:
grep '^[^,]*([0-9]3)[^,]*1'
add a comment |Â
up vote
2
down vote
accepted
POSIXly:
grep '([0-9]3).*1'
Would print the lines that contain 3 decimal digits followed by a sequence of 0 or more characters followed by the same 3 digits.
To restrict that pattern before the first comma:
grep '^[^,]*([0-9]3)[^,]*1'
add a comment |Â
up vote
2
down vote
accepted
up vote
2
down vote
accepted
POSIXly:
grep '([0-9]3).*1'
Would print the lines that contain 3 decimal digits followed by a sequence of 0 or more characters followed by the same 3 digits.
To restrict that pattern before the first comma:
grep '^[^,]*([0-9]3)[^,]*1'
POSIXly:
grep '([0-9]3).*1'
Would print the lines that contain 3 decimal digits followed by a sequence of 0 or more characters followed by the same 3 digits.
To restrict that pattern before the first comma:
grep '^[^,]*([0-9]3)[^,]*1'
answered Dec 15 '17 at 22:07
Stéphane Chazelas
282k53520854
282k53520854
add a comment |Â
add a comment |Â
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%2f411146%2fdisplay-lines-when-the-digits-repeated-in-same-line%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