Find word delete line

2009-05-02 Thread Greg Reyna
I'm trying to write a script that will open an ascii file, search for a word, delete the entire line that word is on, then search again to EOF, and save. Apple Script gives me the shivers. Usually, if I can find a script that does something similar to what I need, I can modify it to make it

Re: Find word delete line

2009-05-02 Thread Seth Dillingham
On 5/1/2009, Greg Reyna said: I'm trying to write a script that will open an ascii file, search for a word, delete the entire line that word is on, then search again to EOF, and save. Apple Script gives me the shivers. Usually, if I can find a script that does something similar to what I need,

Re: Find word delete line

2009-05-02 Thread Roland Küffner
No need for exposure to Applescript. Create a new text factory in BBEdit. Add a step Process lines containing. In the options of that step make sure you have the option Delete matched lines selected. (I recommend the Text factories chapter in the BBEdit User Manual (chapter 5) for more on text

Re: Find word delete line

2009-05-02 Thread John Delacour
At 22:42 -0700 1/5/09, Greg Reyna wrote: I'm trying to write a script that will open an ascii file, search for a word, delete the entire line that word is on, then search again to EOF, and save. A UNIX Filter such as this ought to do the trick: #!/usr/bin/perl my $word = something; while () {

Re: Find word delete line

2009-05-02 Thread Greg Reyna
Thanks Steve, that worked perfectly. I didn't know about that menu item. Also thanks to Seth and Roland. I'm in the middle of learning Python (a language that makes a heck of a lot more sense to me that AS!), and would like to explore Grep. Being a non-math person with a son that's a math

Re: Find word delete line

2009-05-02 Thread Doug McNutt
At 19:14 +0100 5/2/09, John Delacour wrote: #!/usr/bin/perl my $word = something; while () { /$word/ or print } Noting is ever simple. That would need modification to handle the case there the letters constituting $word appear within another word that has more characters than $word. while ()

Re: Find word delete line

2009-05-02 Thread Seth Dillingham
On 5/2/2009, Doug McNutt said: Is a start requiring that $word be surrounded by two non-word characters but will fail when $word begins or ends a line. There's also the problem that perl's definition of a word character includes programming conventions, particularly the underscore. BBEdit

Re: Find word delete line

2009-05-02 Thread Ronald J Kimball
On Sat, May 02, 2009 at 01:05:30PM -0600, Doug McNutt wrote: That would need modification to handle the case there the letters constituting $word appear within another word that has more characters than $word. while () { /\W$word\W/ or print } Is a start requiring that $word be