[TxMt] Re: quick way to find longest line in file?
Bill Paxton
paxton at kitp.ucsb.edu
Fri Jan 29 01:27:08 UTC 2016
Excellent suggestions -- thanks to both of you.
Turns out that I somehow got long sections of trailing blanks in several lines, and that's why a visual scan didn't show the location.
I'm sure there must be a way to delete trailing blanks from all lines -- could you tell me how or point me to the relevant information.
Thanks again,
Bill
On Jan 28, 2016, at 4:33 PM, Matt Neuburg wrote:
> Why not simply do a Find in the document for a regular expression of this sort:
>
> ^.{100,}
>
> ...that is to say, "a line longer than 100 characters"? For 100, substitute any number you think might be exceeded by just this one excessive line. m.
>
On Jan 28, 2016, at 4:14 PM, Hans-Jörg Bibiko wrote:
>
> Hi Bill,
>
> it's fast written ;) - and if you don't have more than 999999999 lines in your document:
>
>
>
> Create a new Command; input: selection or text; output: discard
>
> Command:
>
> #!/bin/sh
> open txmt://open?line=`nl -nrz -w9 -b a|awk '{print length, $0}'|sort -nr|head -1|awk '{print $2}'`
>
>
>
>
> This command will locate the caret at the beginning of the longest line in the current document.
>
> Cheers, Hans
>
>
>
> _______________________________________________
> textmate mailing list
> textmate at lists.macromates.com
> http://lists.macromates.com/listinfo/textmate
More information about the textmate
mailing list