Delete line with 3 or more same charaters?
Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators
-
- Posts: 5
- Joined: Sat Mar 10, 2012 5:44 am
Delete line with 3 or more same charaters?
I have a list from which I need to remove lines which contains 3 or more of the same character anywhere within the line.
I have tried for hours using replace matching word pattern with the following but it just give me an error stating no lines to repeat.
What is most frustrating is more than likely really simple!
Thanks in advance.
I have tried for hours using replace matching word pattern with the following but it just give me an error stating no lines to repeat.
What is most frustrating is more than likely really simple!
Thanks in advance.
-
- Posts: 5
- Joined: Sat Mar 10, 2012 5:44 am
Re: Delete line with 3 or more same charaters?
I have read through http://www.datamystic.com/easypatterns_reference.html and still cannot understand it.
Can anyone help out with it please.
I just basically want to remove any line that has 3 or more of the same character!
Thank you
Can anyone help out with it please.
I just basically want to remove any line that has 3 or more of the same character!
Thank you
-
- Posts: 5
- Joined: Sat Mar 10, 2012 5:44 am
Re: Delete line with 3 or more same charaters?
I think I have come up with a solution to sort out lines up to 7 char long however does seem rather long winded.
I'm sure there must be an easier way to delete lines which contain 3 or more of the same character anywhere within the line?
(a)[b-z](a)[b-z](a)[b-z](a)
[b-z][b-z](a)[b-z](a)[b-z](a)
[b-z](a)[b-z][b-z](a)[b-z](a)
(a)[b-z][b-z][b-z](a)[b-z](a)
[b-z](a)[b-z](a)[b-z][b-z](a)
(a)[b-z][b-z](a)[b-z][b-z](a)
(a)[b-z](a)[b-z][b-z][b-z](a)
[b-z](a)[b-z](a)[b-z](a)[b-z]
(a)[b-z][b-z](a)[b-z](a)[b-z]
(a)[b-z](a)[b-z][b-z](a)[b-z]
(a)[b-z](a)[b-z](a)[b-z][b-z]
I'm sure there must be an easier way to delete lines which contain 3 or more of the same character anywhere within the line?
(a)[b-z](a)[b-z](a)[b-z](a)
[b-z][b-z](a)[b-z](a)[b-z](a)
[b-z](a)[b-z][b-z](a)[b-z](a)
(a)[b-z][b-z][b-z](a)[b-z](a)
[b-z](a)[b-z](a)[b-z][b-z](a)
(a)[b-z][b-z](a)[b-z][b-z](a)
(a)[b-z](a)[b-z][b-z][b-z](a)
[b-z](a)[b-z](a)[b-z](a)[b-z]
(a)[b-z][b-z](a)[b-z](a)[b-z]
(a)[b-z](a)[b-z][b-z](a)[b-z]
(a)[b-z](a)[b-z](a)[b-z][b-z]
- DataMystic Support
- Site Admin
- Posts: 2227
- Joined: Mon Jun 30, 2003 12:32 pm
- Location: Melbourne, Australia
- Contact:
Re: Delete line with 3 or more same charaters?
Use a Remove\Matching lines filter, with an EasyPattern of
[ capture(letter), group1, group1 ]
'group1' refers to the text (ie the letter) already captured, so 3 or more duplicate letters will be removed by this.
[ capture(letter), group1, group1 ]
'group1' refers to the text (ie the letter) already captured, so 3 or more duplicate letters will be removed by this.
-
- Posts: 5
- Joined: Sat Mar 10, 2012 5:44 am
Re: Delete line with 3 or more same charaters?
Thanks although That seems to work if the letters are next to each other, but not when on the same line in different columns.
I need a command to delete a line if it has more than three of the same character anywhere on the line, not just next to each.
for example asasasas ,would not be deleted by [ capture(letter), group1, group1 ]
I need a command to delete a line if it has more than three of the same character anywhere on the line, not just next to each.
for example asasasas ,would not be deleted by [ capture(letter), group1, group1 ]
- DataMystic Support
- Site Admin
- Posts: 2227
- Joined: Mon Jun 30, 2003 12:32 pm
- Location: Melbourne, Australia
- Contact:
Re: Delete line with 3 or more same charaters?
Then use
Code: Select all
[ capture(letter), 0+ not cr or lf, group1, 0+ not cr or lf, group1 ]
-
- Posts: 5
- Joined: Sat Mar 10, 2012 5:44 am
Re: Delete line with 3 or more same charaters?
Excellent, that works thank you