View Single Post
Old 12-02-2010, 03:21 AM   #12
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,775
Karma: 7029857
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by kiwidude View Post
In find/replace, is it possible to take the value from the author_sort field and put it into the author field? Presumably her existing author_sort is probably pretty correct already. If she could do that it would save a lot of typing.
Possible, but probably not a good idea, because it will produce incorrect results for books with multiple authors. The problem arises because authors is a multiple field, but author_sort is a single field. S/R does the work for each item in a multiple field, so each author would be set to the combined author sort. The result would be a mess.

Better would be to use a regexp on author to flop the names around. One would first select all books with no comma in the authors' names, then apply something like the following:
Code:
Mode: regexp
Source: authors
Search: ^(.*) ([^ ]*)$
Replace: \2, \1
Dest: authors
Ignore the fact that the comma becomes a | in the result. This happens because calibre uses comma to separate authors, so internal commas are changed to bars.
chaley is offline   Reply With Quote