Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 09-29-2017, 10:39 AM   #1
Said124
Junior Member
Said124 began at the beginning.
 
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 !
Said124 is offline   Reply With Quote
Old 09-29-2017, 02:05 PM   #2
arensb
High Exalted Logovore
arensb began at the beginning.
 
arensb's Avatar
 
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:
Lookup name: author_pub
Column heading: Author + Publisher
Column type: Column built from other columns
Template: {authors}/{publisher}
Then you can look for books where the #author_pub column has some value, followed by a slash, followed by the first value:
Quote:
#author_pub:"~^(.*)/\1$"
Where "#author_pub:" means "we're going to be searching the author_pub column.
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.
arensb is offline   Reply With Quote
Advert
Old 09-29-2017, 05:42 PM   #3
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,583
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by arensb View Post
I don't see a way to search by multiple columns.
FYI ==>> MultiColumnSearch Plugin

Not implying it can do what you suggestion does.

BR
BetterRed is offline   Reply With Quote
Reply


Forum Jump

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


All times are GMT -4. The time now is 11:17 AM.


MobileRead.com is a privately owned, operated and funded community.