in reply to (jeffa) Re: Searching for variable then blank lines
in thread Searching for variable then blank lines
/($arc.*?\n)\n\n/s
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(jeffa) 3Re: Searching for variable then blank lines
by jeffa (Bishop) on Mar 14, 2002 at 12:12 UTC | |
Try it out: ;) I'm sticking to my answer (well, if i had COPIED IT CORRECTLY!!! bad jeffa!) , remember that the 's' modifier allows . to match that newline. Your suggestion would be pretty much the same (and i will admit possibly a bit safer) except you NEED 'm' and ^ in case ARCSERVE.NLM appears in the middle or end of a line. jeffa L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat) | [reply] [d/l] |
by rscott212 (Sexton) on Mar 14, 2002 at 19:38 UTC | |
Thanks to everyone who has helped me on this. I must be dense. :-\ Now I am getting my script to read in my file and go down to the beginning of the line starting with ARCSERVE.NLM, and it gives me *every* line after that. My script is not not exiting when it finds the first 2 returns after ARCSERVE.NLM for the first time. Below is my script and a sample of the output file.
This is just an example. My file was much larger than this. I was not wanting the information starting with ASDB.NLM to the end of the file. What do I need to do to make this happen? Thx again! | [reply] [d/l] |
by jeffa (Bishop) on Mar 15, 2002 at 15:05 UTC | |
Ok, i changed this line: To this: And it worked ... there was one extra newline at the end of the extracted data, but i'll get to that in a moment. (And for the record, one of your 'blank lines' had a single space in it.) Now, some thoughts on your thoughts. First, please learn how to indent properly. When i first glanced at your code, i really believed that the last two if blocks were OUTSIDE the foreach loop. Please, for the sanity of those trying to help, use good formatting: That makes all the difference in the world. Second, the integer 1 (one) makes a great true value. Instead of assigning a boolean flag the scalar value 'TRUE', just use 1 (one). Last, you have a lot of unecessary code - here is a slight improvement for you to ponder: This produces (using your data file) the following output: ARCSERVE.NLM Version: 1 Date: 10/22/2000 ID: 000 Parent ID: x Type: UNKNOWN Description: ARCserve Flags:Hope this helps. :) jeffa L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat) | [reply] [d/l] [select] |