At 13:00 -0700 3/29/12, Todd wrote:
>Long story short: I'm needing to open some word processing files that
>can't be opened in Mac OSX Lion (Lion vs. Rosetta thing...) and need a
>bit of helping creating a Text Factory.
>
>When I open the files in BBEdit, I get a string of characters,
>anywhere from 50-100 characters (such as
>"400000 0ÇÇ 480048 -2 2 91A 20 0Å 20 -1Ç 91F 921 909 90B 0¬  2 13 91A 1DB FFF")
>that are immediately followed by a COMMA, then begins the text.
>
>Is there a way to create a Text Factory that will look for the first
>instance of this COMMA, then delete it and everything PRECEDING it?
>
>Also, there's a block of text at the end of every doc containing
>similar strings. I guess what I need there is something like "find the
>LAST instance of a period, then delete every character after that."
>
>Or is something like this better suited to an AppleScript? Any ideas
>where I can start here?
>

$data = result of reading the contents of the file into a string.
$data =~ s/\A.*,//;
$data =~ s/\.[^.]*\Z//;

BBEdit converts what it reads to 16 bit - almost all of UTF - characters which 
might well get confused with what is apparently binary stuff at the start of 
the files. That might make a Text Factory fail unless there is a way to apply 
the factory before reading the file into memory. I'm limited to OS X 10.3.9 and 
there have been changes.

Assuming your file is 8 bit stuff like UTF-8 or ASCII the above is what I would 
use before trying to open it with BBEdit. Perl or sed will handle the regular 
expressions. \A is the beginning of a file and \Z is the end with an optional 
line end.

Putting the binary stuff back is likely impossible especially if it depends on 
the text you will be working with.


-- 

--> A fair tax is one that you pay but I don't <--

-- 
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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

Reply via email to