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 08-11-2019, 05:28 AM   #1
yamusing
Enthusiast
yamusing began at the beginning.
 
Posts: 47
Karma: 10
Join Date: Jul 2019
Device: none
Title to publisher sort

I've got books with titles for example "publisher1 - book title", "publisher2 - book title", "publisher3 - book title" etc. already imported into calibre. How would I go about using the Search and Replace function to search for all the characters before the "-" and then move them over to the publisher field?
yamusing is offline   Reply With Quote
Old 08-11-2019, 05:43 AM   #2
yamusing
Enthusiast
yamusing began at the beginning.
 
Posts: 47
Karma: 10
Join Date: Jul 2019
Device: none
Quote:
Originally Posted by yamusing View Post
I've got books with titles for example "publisher1 - book title", "publisher2 - book title", "publisher3 - book title" etc. already imported into calibre. How would I go about using the Search and Replace function to search for all the characters before the "-" and then move them over to the publisher field?
Forgot to add to only book titles with a space before the dash " -", such as titles like "book-title" doesn't get searched for.
yamusing is offline   Reply With Quote
Advert
Old 08-11-2019, 09:39 AM   #3
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,057
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by yamusing View Post
I've got books with titles for example "publisher1 - book title", "publisher2 - book title", "publisher3 - book title" etc. already imported into calibre. How would I go about using the Search and Replace function to search for all the characters before the "-" and then move them over to the publisher field?
I do this in 2 steps: 1) copies to new home. 2) removes from original home
Bulk mode S&R both use the same REGEX search

search Title:
(.+?)\s-\s(.+?)

1)
Replace Publisher:
\1

2)
Replace Title:
\2
theducks is offline   Reply With Quote
Old 08-11-2019, 01:50 PM   #4
yamusing
Enthusiast
yamusing began at the beginning.
 
Posts: 47
Karma: 10
Join Date: Jul 2019
Device: none
Quote:
Originally Posted by theducks View Post
I do this in 2 steps: 1) copies to new home. 2) removes from original home
Bulk mode S&R both use the same REGEX search

search Title:
(.+?)\s-\s(.+?)

1)
Replace Publisher:
\1

2)
Replace Title:
\2
Tested it out but it doesn't seem to work right. With the title "publisher1 - book title" doing step one outputs "publisher1ook title" to the destination field publisher.
yamusing is offline   Reply With Quote
Old 08-11-2019, 05:29 PM   #5
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,057
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by yamusing View Post
Tested it out but it doesn't seem to work right. With the title "publisher1 - book title" doing step one outputs "publisher1ook title" to the destination field publisher.
If you did it right, the test column (right side) would show just Publisher whuch was regex capture 1
Which should include everything up to: space dash space

Is there a second space dash space in the Title field?
theducks is offline   Reply With Quote
Advert
Old 08-11-2019, 08:11 PM   #6
yamusing
Enthusiast
yamusing began at the beginning.
 
Posts: 47
Karma: 10
Join Date: Jul 2019
Device: none
Quote:
Originally Posted by theducks View Post
If you did it right, the test column (right side) would show just Publisher whuch was regex capture 1
Which should include everything up to: space dash space

Is there a second space dash space in the Title field?
I've tested it on the title "Rowli Ng - Harry Potter" where the "Rowli Ng" is the publisher and "Harry Potter" is the book title. The test results as "Rowli Ngarry Potter" in the publisher column.

Search mode: "Regular expression"
Search field: "title"
Search for: "(.+?)\s-\s(.+?)"
Replace with: "\1"
Destination field: "publisher"
yamusing is offline   Reply With Quote
Old 08-11-2019, 08:20 PM   #7
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,057
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
No quote marks in those terms?
I have no idea why the capture is grabbing that

The destination WAS blank. (or set it to Replace)?
theducks is offline   Reply With Quote
Old 08-11-2019, 10:26 PM   #8
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: 21,725
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
@yamusing - try this

Click image for larger version

Name:	Clipboard.jpg
Views:	154
Size:	93.9 KB
ID:	172878

Not sure why the other one didn't work.

BR
BetterRed is offline   Reply With Quote
Old 08-12-2019, 12:04 AM   #9
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by BetterRed View Post
@yamusing - try this

Attachment 172878

Not sure why the other one didn't work.
The "?" are for "non-greedy". In the original suggestion, the groups will only matching one character one each side of the space-dash-space.

Using the following might be safer:

Code:
^(.+?)\s-\s(.+?)$
That says you want to match the whole title where there is a space-dash-space in the middle. The non-greedy probably isn't needed unless there is a chance for two space-dash-space matches in the original title.
davidfor is offline   Reply With Quote
Old 08-12-2019, 06:32 AM   #10
yamusing
Enthusiast
yamusing began at the beginning.
 
Posts: 47
Karma: 10
Join Date: Jul 2019
Device: none
Quote:
Originally Posted by davidfor View Post
The "?" are for "non-greedy". In the original suggestion, the groups will only matching one character one each side of the space-dash-space.

Using the following might be safer:

Code:
^(.+?)\s-\s(.+?)$
That says you want to match the whole title where there is a space-dash-space in the middle. The non-greedy probably isn't needed unless there is a chance for two space-dash-space matches in the original title.
thanks, this REGEX works without problem
yamusing is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sort by Author doesn't then sort by title jmcging Library Management 7 07-02-2017 10:16 PM
title and title sort are omitting leading charcters pinky62 Library Management 6 09-02-2016 03:18 AM
'Title Sort' & 'Author Sort' Search/Report Funkybassman Calibre 3 04-17-2016 12:31 PM
Update 'title sort' and 'author sort' through CLI wladdy Library Management 1 07-16-2015 05:12 PM
How do I set sort title based on the title with multiple books? loviedovie Calibre 2 02-09-2015 03:08 PM


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


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