I have a file that looks like this:

123456 "/path/to/file name/with spaces"

with several thousand lines.

I want to run a text-factory that gets the number, runs it through a bit of 
python code, and replaces it with the result without touching the rest of the 
line. So I would end up with something like

8578810 "/path/to/file name/with spaces"

where 8578810 is the result of the python script

Do I need import sys in the python file? How can I pass line by line to the 
python script?

(my other text factories simply pass the whole file in, or simply have a bunch 
of BBEdit actions and no script)

I'd do this in perl, but the functions I need (to ordinal/fromordinal) are in 
python.

Is there an equivalent to 

while (<>) {
   $line = $_;
   # do stuff with $line
   print $line;
}

??

-- 
"I have never killed a man, but I have read many obituaries with great
pleasure." Clarence Darrow

-- 
-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem, 
please email "[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to