On 31 Mar 2006, at 18:54, Scott Haneda wrote:

Is there some way to resequence my numbers, always in order?

*Yes, I know, it would be nice if my language returned named variables, but
it does not

Second issue, is that in most cases, my variable names are not always the
same length, but I like to line them up on the "=" sign:

Test     = "test";
Thistest = "test";

Is there any way to automatically do this as well?

Straighforward enough with a bit of script and a couple of regexes. Should be easy enough in Perl or whatever. Here's my version, a newLisp Unix filter:


(set 'file (open ((main-args) 2) "read"))
(set 'counter 0)
(while (read-line file)
(set 'temp (replace {(.*')(\d)} (current-line) (string $1 (inc 'counter)) 0 )) (println (set 'l (replace {(\S*)(\s*)(=.*)} temp (string $1 (dup " " (- 12 (length $1))) $3 ) 0 ))))
(exit)


which will turn

foo = anItem '1;
bar = anItem '2;
cat = anItem '2;
dog = anItem '4;


Test = "test";
Thistest = "test";

into

foo         = anItem '1;
bar         = anItem '2;
cat         = anItem '3;
dog         = anItem '4;


Test        = "test";
Thistest    = "test";

although here I'm assuming that you're starting counting from 1. It would be an extra line to work out the initial number if not zero...

Oh, sorry, I've just noticed that some solutions have already arrived in my inbox. Never mind, was good practice...! :-)

cheers

Pete

--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>

Reply via email to