I need to delete every line that contains less than 4 words or more than 10.
What can I do?
Delete each line with less than 4 words and...
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
Can you provide some more information on the sort of text you want to search? Is this structured data or English prose? Is it punctuated in some way?
If this is prose rather than data then words can be separated by spaces, commas, semi colon, question marks etc.
Please post an example.
If this is prose rather than data then words can be separated by spaces, commas, semi colon, question marks etc.
Please post an example.
Running TextPad 5.4 on Windows XP SP3 and on OS X 10.7 under VMWare or Crossover.
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
Use "Posix" regular expression syntax:
Remove lines that contain fewer than 4 words:Configure | Preferences | Editor
[X] Use POSIX regular expression syntax
Remove lines that contain more than 10 words:Find what: ^(\<[a-z0-9_']+\>[^a-z0-9_']*){1,3}\n
Replace with: [nothing]
[X] Regular expression
Replace All
Find what: ^(\<[a-z0-9_']+\>[^a-z0-9_']*){11,}\n
Replace with: [nothing]
[X] Regular expression
Replace All
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
These are more accurate:
Remove lines that contain fewer than 4 words:
Remove lines that contain fewer than 4 words:
Remove lines that contain more than 10 words:Find what: ^[^a-z0-9_']*([a-z0-9_']+[^a-z0-9_']+){0,2}[a-z0-9_']+[^a-z0-9_']*\n
Replace with: [nothing]
[X] Regular expression
Replace All
Find what: ^[^a-z0-9_']*([a-z0-9_']+[^a-z0-9_']+){10,}[a-z0-9_']+[^a-z0-9_']*\n
Replace with: [nothing]
[X] Regular expression
Replace All
Thanks i follow your instruction and work well....
Have file like this:
mybuyeremail@email.com:mybuyeraddress
mybuyeremail3@email.com:
mybuyeremail4@email.com:
mybuyeremail1@email.com:mybuyeraddress1
how to delete all line donot contain mybuyeraddress....
TQ
Have file like this:
mybuyeremail@email.com:mybuyeraddress
mybuyeremail3@email.com:
mybuyeremail4@email.com:
mybuyeremail1@email.com:mybuyeraddress1
how to delete all line donot contain mybuyeraddress....
TQ
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm