03-16-2013, 04:24 AM | #1 |
Groupie
Posts: 178
Karma: 134
Join Date: May 2010
Device: IREX DR1000
|
How to copy only first N character from filename ?
Hi,
is there a RegEx way to copy only the first N characters from Title to the ISBN field ? Thanks in advance |
03-16-2013, 05:02 AM | #2 |
Grand Sorcerer
Posts: 11,728
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Using bulk edit search & replace:
Search field: title Search for: ^(.{5}).* Replace with: \1 Destination field: identifiers Identifier type: isbn Replace the "5" in Search for with the number you really want. |
03-16-2013, 12:34 PM | #3 | |
Groupie
Posts: 178
Karma: 134
Join Date: May 2010
Device: IREX DR1000
|
Quote:
Thanks ! Last edited by Giuseppe Chillem; 03-16-2013 at 12:36 PM. |
|
03-16-2013, 12:55 PM | #4 | |
Well trained by Cats
Posts: 29,762
Karma: 54401244
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Decoding: Code:
^ must be at the beginning of the line ( start the [first] capture sequence the dot any character {x} Repetition rule 5 exactly 5 times, 2,5 would be 2 to 5 times, ) end of [first] capture the replace: \1 use the [first capture value] ISBN 10 can have an 'X' as the last ^(\d{9}(\d|X|x)) not tested this supposed to say Match the first 9 digits from the start AND match the next if it is a digit OR x (either case) |
|
03-17-2013, 04:50 PM | #5 | |
Groupie
Posts: 178
Karma: 134
Join Date: May 2010
Device: IREX DR1000
|
Quote:
1616084855IWIWEF -> IWIWEF |
|
03-17-2013, 05:01 PM | #6 | |
Well trained by Cats
Posts: 29,762
Karma: 54401244
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
BTW I just did a test in Sigil: Find found the ISBN Then I changed the lat 5 to an x It found that kind also. Slash 1 contained the ISBN Captured |
|
03-17-2013, 11:25 PM | #7 |
Handy Elephant
Posts: 1,736
Karma: 26785668
Join Date: Dec 2009
Location: Southern Sweden, far out in the quiet woods
Device: Thinkpad E595, Ubuntu Mate, Huawei Mediapad 5, Bouye Likebook Plus
|
I suspect that the /1 was not used in the replace dialog.
In the Replace With box /1 must be specified, otherwise you have specified that you want to replace the matched isbn with nothing, in effect deleting it. And you end up with: 1616084855IWIWEF -> IWIWEF The /1 specifies that you want to use the contents of the first matching parentheses. The matched isbn. Last edited by Adoby; 03-17-2013 at 11:28 PM. |
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
"Copy to Libary (delete after copy)" - Placement Suggestion | plib | Library Management | 8 | 07-17-2012 09:53 PM |
using filename for title | pj123 | Calibre | 1 | 05-22-2011 06:18 PM |
soft copy vs. hard copy no more. | smokey | News | 4 | 12-02-2007 02:57 PM |
txt filename? | fishcube | Sony Reader | 1 | 10-19-2007 12:56 AM |
gmail copy (gmcp) - Perl script to copy files to/from Gmail | Colin Dunstan | Lounge | 0 | 09-04-2004 01:24 PM |