Character to find "filename" in grep?

274 views
Skip to first unread message

bob51200

unread,
Jan 1, 2009, 9:37:01 PM1/1/09
to BBEdit Talk
I'm trying to find the character or string to use in a batch grep find/
replace pattern that will insert the file's name into the result.
Here's my grep replace pattern:

<a class="viewLink" id="\1" href="_" onClick="viewSection('\2');">
\3<strong>+</strong></a>

In the search pattern, there's a # sign in the link (href="#"), and I
want to replace the # sign with the filename. I've found Perl's
charater: $file, but it doesn't work in grep.

So, is there a character that will allow me to do this, or am I out of
luck?

TIA,

Bob

Patrick James

unread,
Jan 2, 2009, 1:43:27 PM1/2/09
to bbe...@googlegroups.com
Hi

I think you might like to try using the BBEdit placeholder:

#FILENAME#

You can put that in your Grep replace pattern.

Then after find/replace use this command in the menu: Markup -> Update
-> Document.

Patrick

http://www.patrickjames.co.uk

Reply all
Reply to author
Forward
0 new messages