Limiting the consecutive occurrence
#31
So we are limiting it to this so far...

No more than 2 instance of upper alpha consecutively.
No more than 2 of any character within a single line

with this command

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

Which on letter "A" produces this

Code:
AABBCCDD
AABBCCDE
AABBCCDF
AABBCCDG
AABBCCDH
AABBCCDI
AABBCCDJ
AABBCCDK


How would you limit the total amount of times a consecutive instance can happen to say one?

Code:
AABBCCDD

So in the line above "A" is the first character to appear twice, when the character "B" appear twice, the line would be deleted. Even if the line was

Code:
ABCADEFB

because "A" is still the first character to appear twice the line would still be deleted when the "B" appear twice as the second "A" came before the second "B"

Hope this make sense Smile

Can this be done with sed?


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:15 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