jmichel,
I'm assuming from your question that you are able to find the line you
want to replace.

If you want to replace your find with the file name--hardcoded--I
would suspect that Applescript would be the choice of many, but I
can't seem to get anything to work for me with Applescript. I'm sure
it's my problem.

You might consider BBEdit's "Include" options, specifically the
persistent include mentioned on p. 380+ of my manual. For instance,
starting with a short html test file (as per the example)
<html>
<head>
    <title>Include Test</title>
    <meta name="generator" content="BBEdit 9.2">
</head>
<body>
<!-- #bbinclude "filenamefoo.pl" -->
<!-- end bbinclude -->
</body>
</html>

When this file is Updated (Markup-> Update-> Document) the name of the
current file is inserted into the document. You can put this in any
file and it will update to include the document name. It depends on
the short Perl program placed (in this case the same directory as the
test file).
#!/usr/bin/perl -w
# saved as filenamefoo.pl
my $file = shift @ARGV;
print "Filename: $file\n";

Hope this helps. I'm sure there are other ways of accomplishing what
you want done.

Bucky

On Thu, Feb 11, 2010 at 5:49 PM, jmichel <[email protected]> wrote:
>
> Hi,
> Does anybody know whether it is somehow possible to include the
> current file name in a grep "replace" pattern when doing a multi-file
> search/replace. I have a case now where I need to replace one line in
> each of my files by a string containing the name of the file in which
> the line occurs.
> I am sure this can be done in unix using a sed script but I am not too
> familiar with the syntax, therefore I wondered whether BBEdit could do
> the job. Thanks…
>
> --
> 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.

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

Reply via email to