09-29-2017, 10:39 AM | #1 |
Junior Member
Posts: 6
Karma: 10
Join Date: Sep 2017
Device: Sony PRS T1
|
Search/Replace with condition
Hello,
My library contains many books whose author and publisher fields are identical. I would like to know if it is possible to automate the modification of the publisher field with a condition like this : if publisher is identical to author then replace the publisher field with this word: HomeMade I would like to know if it's possible to use the search/replace option or should i use a model.... I'm quite a newbie and i spent a couple of hours to do it, unsuccessfully. Thank you for any help ! |
09-29-2017, 02:05 PM | #2 | ||
High Exalted Logovore
Posts: 2
Karma: 10
Join Date: Sep 2017
Device: Kindle Voyage
|
I don't see a way to search by multiple columns. But what you can do is build an intermediate column #author_pub, whose value is the author and publisher, separated by a slash. Create it in Settings > Add your own columns:
Quote:
Quote:
The double quotes just group things together. "~" means "we're doing a regular expression search, not an ordinary string search. "^" means "beginning of string" and "$" means "end of string". So we're looking for "(.*)/\1" and nothing else. Basically, we don't want to do a substring search: you don't want to look for books where the author is "Smith" and the publisher is "Smith and Jones", or where the author is "Jones and Smith", and the publisher is "Smith". ".*" means "any number of characters", and the parentheses around that basically mean "remember this for later". "\1" means "the first parenthesized expression". Finally, the slash "/" is just a slash, because that's what separates the author from the publisher in this custom column. Putting all that together, we're constructed a custom column with the author and publisher, separated by a slash. And then we search that column for some sequence of characters starting at the beginning, then a slash, and then the same sequence of characters as before, and finally the end of the string. You can then select all books in that result, and use the Bulk Metadata editor to replace the publisher. |
||
Advert | |
|
09-29-2017, 05:42 PM | #3 |
null operator (he/him)
Posts: 20,583
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Regex in search problems (NOT Search&Replace; the search bar) | lairdb | Calibre | 3 | 03-15-2017 07:10 PM |
save multiple search/replace, or search/replace multiple ebooks | user743 | Editor | 12 | 04-12-2014 02:38 AM |
Search/Replace ID? | OldLincoln | Calibre | 4 | 09-04-2013 03:50 PM |
search and replace - drops blanks in replace ? | cybmole | Conversion | 10 | 03-13-2011 03:07 AM |
Why no search and replace? | charleski | Sigil | 10 | 11-24-2009 04:13 PM |