Limiting the consecutive occurrence
#33
(05-28-2012, 06:43 AM)M@LIK Wrote: @Pixel:: I believe this is what you want:
Code:
A BUG found!

I don't what you people trying to do...
I'm just the scripting guy!! xD

EDiT:
"A BUG found!"
Try this one:
Code:
sed "/\(.\)\1\1/d;/\(.\).*\1.*\1/d;/\(.\).*\1.*\(.\).*\2/d;/\(.\).*\(.\).*\1.*\2/d"

That was quick, you are a sed scripting god M@LIK Big Grin Thanks

M@LIK, it not working as I'd hoped

Code:
AABACDEF
AABACDEG
AABACDEH
AABACDEI
AABACDEJ
AABACDEK

breaks this rule

No more than 2 of any character within a single line


Edit: I got it working but can't be sure as I don't understand the command at all but notice you added
Code:
/\(.\).*\1.*\(.\).*\2/d

and
Code:
/\(.\).*\(.\).*\1.*\2/d

so I remove one of them. The command I using that seems to work is

Code:
sed "/\(.\)\1\1/d;/\(.\).*\1.*\1/d;/\(.\).*\1.*\(.\).*\2/d"

and output is

Code:
AABCDEFG
AABCDEFH
AABCDEFI
AABCDEFJ
AABCDEFK
AABCDEFL

these extra commands have slowed it down even more lol, shame they is no GPU version of sed or even a mulit-core version Smile


Messages In This Thread
Limiting the consecutive occurrence - by Hash-IT - 05-23-2012, 12:38 AM
RE: Limiting the consecutive occurrence - by ntk - 05-27-2012, 01:28 PM
RE: Limiting the consecutive occurrence - by TAPE - 05-27-2012, 11:36 PM
RE: Limiting the consecutive occurrence - by Pixel - 05-28-2012, 06:55 AM
RE: Limiting the consecutive occurrence - by ntk - 05-28-2012, 09:57 AM
RE: Limiting the consecutive occurrence - by ntk - 05-29-2012, 12:12 AM
RE: Limiting the consecutive occurrence - by ntk - 05-29-2012, 02:19 AM
RE: Limiting the consecutive occurrence - by ntk - 05-29-2012, 04:02 AM
RE: Limiting the consecutive occurrence - by ntk - 05-30-2012, 10:11 AM
RE: Limiting the consecutive occurrence - by ntk - 06-01-2012, 11:30 PM
RE: Limiting the consecutive occurrence - by ntk - 06-02-2012, 10:48 AM
RE: Limiting the consecutive occurrence - by ntk - 06-03-2012, 12:56 AM
RE: Limiting the consecutive occurrence - by ntk - 06-03-2012, 01:07 PM
RE: Limiting the consecutive occurrence - by ntk - 06-03-2012, 02:14 PM
RE: Limiting the consecutive occurrence - by ntk - 06-05-2012, 02:08 AM
RE: Limiting the consecutive occurrence - by ntk - 06-05-2012, 02:48 AM
RE: Limiting the consecutive occurrence - by aGia - 06-07-2012, 11:26 PM
RE: Limiting the consecutive occurrence - by ntk - 06-08-2012, 12:13 AM
RE: Limiting the consecutive occurrence - by aGia - 06-08-2012, 12:24 AM
RE: Limiting the consecutive occurrence - by ntk - 06-08-2012, 12:29 AM
RE: Limiting the consecutive occurrence - by ntk - 06-08-2012, 01:52 AM
RE: Limiting the consecutive occurrence - by d333 - 09-04-2012, 01:56 PM
RE: Limiting the consecutive occurrence - by atom - 09-04-2012, 02:04 PM