From: "George J. De Bruin"
> The following macro will do that, but it also works with the menu Find,
> although you would have to do a lot of repeated typing then.
Hi Carlo,
Looks like I forgot to CC my response to Dave's original message to the
mailing list... You and I think a lot alike. Here's a copy of
my message...
-----------------------------------------------------
> I'm stumped on one. How can I use compressed view to return line
> numbers and their length for all lines in the file longer than 80
> characters? I haven't been able to figure out how to use find and a
> regular expression to return a compressed view of lines longer than 80
> characters, and if I could, I'm not sure how I'd get the length into
> the compressed view.
Believe it or not, this one took me a minute... But, then it
dawned on me... Regular expressions! You have the "." operator which
matches 1 character -- use 80 of them with a '#' operator to make sure
there is 1 or more characters following them.
Now, with a couple of minutes of coding I came up with the following:
proc FindLong()
lFind(format("":80:".")+"#","ixvg")
end
FindLong()
Which can be modfifed (generalized) to find all lines in a file over a
specified length by making a small modification:
proc FindLongLines()
string sFndLength[3] = "80"
// Note: the following if statement got wrapped -- unwrap it before
// compiling
if Ask("Find strings longer than:", sFndLength) and Val(sFndLength)
< 254
lFind(format("":Val(sFndLength):".")+"#","ixvg")
else
Warn("Max allowed value is: 254")
endif
end
FindLongLines()
Anyway, I think you get the idea... You can modify the options to your
desiring, or even add a prompt for them. You could also make the
sFndLenght variable a parameter to the function so you can call it from
other macros if you want... Hopefully this gets you started.
> All ideas and suggestions will be gratefully accepted! Thanks in
> advance.
Well, I hope this one will do it for you... Kinda a messy way to do it,
but at least I didn't have to type 80 periods.
// George
// Former SemWare Support
---
---------------
* Origin: apana>>>>>fidonet [sawasdi.apana.org.au] (3:800/846.13)
|