Including Filename & External Data

General discussions about Advanced Find and Replace
Post Reply
Diglet
Posts: 3
Joined: Fri Feb 03, 2006 4:18 pm

Including Filename & External Data

Post by Diglet »

Hello,

I am creating product pages for a website. There are thousands of beads - Each one has an img file, and a .doc file (containing that particular bead's description). The img file names are the same as the .doc names, reflecting the particular beads product # - For example, bead #11145 is shown in img file 11145.jpg, and described in 11145.doc. I have a basic template setup for these pages, say 11145.html. I can't seem to get Find & Replace to take 11145.html, and insert it's filename (11145) into the HTML (ex: img src=FILENAME, and Description: [inserted from 11145.doc) - Is any of what I'm describing possible to do with this program? Please let me know, thanks!

Abacre
Site Admin
Posts: 1223
Joined: Mon Jan 31, 2005 5:32 pm

Post by Abacre »

Hello,

You cannot take description from 11145.doc (in current version of the software)

But you can "take 11145.html, and insert it's filename (11145) into the HTML (ex: img src=FILENAME)"

Please read about "Include File Name into Search Scope" option on the
following page:
http://www.abacre.com/afr/manual/optsbatch.htm
So you should use Batch Replace operation with checked "Include File Name into Search Scope" and "Use regular expression" options.
Then create needed regular expression for this case.
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

Diglet
Posts: 3
Joined: Fri Feb 03, 2006 4:18 pm

Post by Diglet »

I have tried several times and I simply cannot get this to work. Are there settings I should change, or any other ways I could try to do this? Please let me know, thank you!

Diglet
Posts: 3
Joined: Fri Feb 03, 2006 4:18 pm

Post by Diglet »

So there's no way to fix this?

wckc
Posts: 6
Joined: Mon Mar 20, 2006 1:54 am

Post by wckc »

I can't get this to work either. I don't even need to do anything as complicated as their example.

I just want to add the complete file name to the end of text in the file.

Text: XXXXXXX.com/ +FILENAME

:cry:
Wally

Abacre
Site Admin
Posts: 1223
Joined: Mon Jan 31, 2005 5:32 pm

Post by Abacre »

Wally,

Do you work with Word/Excel files or with text files (TXT, HTML, ASP
or others)?
Adding file name to the end of file is quite easy task.
What you you mean in your example:
Text: XXXXXXX.com/ +FILENAME

What is source text of the file and what text should be after
transformation (adding filename).
Do you need to add only file name or full path + file name?
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

wckc
Posts: 6
Joined: Mon Mar 20, 2006 1:54 am

Post by wckc »

I am working with .html files named, p3712.html, p3713.html, p3714.html etc. (I don't need the path)

I want to change the contents of each of the files, adding the file name to the end of http://www.booksofthebible.com. All files have the same content.

All Files
From:
<HTML><?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.booksofthebible.com");
exit();
?></HTML>

file p3712.html
To:
<HTML><?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.booksofthebible.com/p3712.html");
exit();
?></HTML>

file p3713.html
To:
<HTML><?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.booksofthebible.com/p3713.html");
exit();
?></HTML>

etc..

Thank you in advance,

Wally
Wally

Abacre
Site Admin
Posts: 1223
Joined: Mon Jan 31, 2005 5:32 pm

Post by Abacre »

The last question: could you type resulting files (after replace) based on your source files?
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

wckc
Posts: 6
Joined: Mon Mar 20, 2006 1:54 am

Post by wckc »

The to: was the contents of the result files:

These are the result files

p3712.html This is the file name

To: this is the result I want

<HTML><?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.booksofthebible.com/p3712.html");
exit();
?></HTML>

p3713.html This is the file name

To: this is the result I want

<HTML><?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.booksofthebible.com/p3713.html");
exit();
?></HTML>

I'm starting out with the generic

<HTML><?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.booksofthebible.com");
exit();
?></HTML>

Wally
Wally

Abacre
Site Admin
Posts: 1223
Joined: Mon Jan 31, 2005 5:32 pm

Post by Abacre »

Ok. Step-by-step instructions:

Go to main menu - Action - Options - Batch Replace
check "Include file name into search scope"
check "Modifier S"
check "Modifier G"

Go to Batch replace tab, check on "Use regular expressions".
Put into the grid, search for:
.*\\(.*html)\r\n(.*Location: http://www\.booksofthebible\.com)

Replace with:
\r\n$2/$1

That's all I verified it works perfectly.
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

wckc
Posts: 6
Joined: Mon Mar 20, 2006 1:54 am

Post by wckc »

:) Thanks Roman, it does work. What did I just do?

Do you have any directions anywhere for the modifiers and what does \r\n$2/$1 do?

It's not clear how to use this program unless there is more to "help" than I am seeing.

Thanks again for making my liofe a little easier. I spent a few hours trying to figure this out without success.


Wally
Wally

Post Reply