Am 01.09.2011 um 1, 02:05 schrieb JT:

> Hi,
> 
> I have 30 language files that I automate graphics production and the
> text files are identical except each one calls a new file in the path.
> For example,
> 
> file://KR.tif
> 
> and I need to change the 'KR' to AU, GB, DK and so on and save each
> find and replace as a new text file. Can this be done with BBEdit? Is 
> this something else other than what BBEdit was designed for?

Hi,

the scripts from John and Chris provide pretty good solutions (as always with 
that two very kind and helpful list members). I just wanted to add a different 
way to achieve this without the need for scripting (ok, I'm using some shell 
commands but only the most basic ones). I would use BBEdit's Shell Worksheets 
and placeholders to do this:

Assuming you have a folder "myproject" on your desktop and your master file is 
placed in it and named "master.txt", do the following.

1) In your master file replace every occurrence where you want to change the 
language code with #BASENAME# (in your example file://KR.tif would become 
file://#BASENAME#.tif)

2) Open a new Shell Worksheet and write this in it:

cd ~/Desktop/myproject
cp master.txt EN.html
cp master.txt DE.html
cp master.txt GB.html
... and so on

(extra tipp: just write down a list of your abbreviations one on each line, 
select all lines and use Text > Prefix/Suffix Lines to add everything else in 
one go)

And: just ignore, that your duplicate files are will be html files. They need 
to be named such to make step 4 work.

3) Select all lines from step 2 and hit Enter (not return!) This should execute 
all the lines duplicating your master file into all the needed language 
versions.

4) Select Markup > Update > Folder and update the myproject-Folder. (This 
command will ignore simple text files, so we had to disguise them as html in 
step 2).

This step should replace the placeholders in each file with the filename text 
("EN", "DE, ...).

5) Rename the files back to something meaningful after updating them. Just 
repeat the technique from step 2 with a list of commands similar to:
mv EN.html 'my more meaningful file name_EN.txt'
mv DE.html 'my more meaningful file name_DE.txt'
and so on ...


I don't want to compete with the elaborate script solutions already provided. I 
just wanted to add, that BBEdit provides powerful tools you can use to create 
simple quick and dirty solutions that are very flexible and may be easier to 
adapt to similar problems (same, same, but different). To learn it's powers, I 
highly recommend to read the very fine manual on a rainy weekend (or even 
before that).

happy editing,
Roland

-- 
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>

Reply via email to