![]() |
#1 |
Junior Member
![]() Posts: 7
Karma: 10
Join Date: Mar 2016
Device: Kindle Fire 7"
|
Find and deletes lines
Hi Guys,
Is there way to delete an entire line from the entire file. I'm editing an epub, and I want to delete every line 14 from the entire book. And is there a way to delete <p> Chapter 123: Random Chapter Name </p> <p> Chapter 124: Random Chapter Name </p> <p> Chapter 125: Random Chapter Name </p> all in one go. Instead of going to each chapter and deleting that line. Sorry, I cant think of a better way to explain it |
![]() |
![]() |
![]() |
#2 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,303
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
What you are looking for is called a regular expression, or Regex. The basics of Regex-ese is fairly simple and straightforward. Don't get alarmed by some of the more advanced stuff, you (almost) never need the super advanced stuff.
For your Chapter example, I would use: Find: <p>\s*Chapter (\d+): (.*?)\s*</p> Replace: [leave blank] Make sure you have Regex as the Mode and then I would just do them one at a time until you are confident you got them all. FYI the funny codes are simply wildcards: Code:
<p>\s*Chapter (\d+): (.*?)\s*</p> \s* means any (or none) blank spaces (\d+) means any group of 1, or more, numerical digits (.*?) means any group of characters before stopping at any space before the </p> <---> I'm not aware of a way to select "line 14" and delete it, but if it has a consistent formatting or something that you can use the regex search to find then I'd use that. Last edited by Turtle91; 03-02-2023 at 10:47 PM. |
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,616
Karma: 29710338
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
BR |
|
![]() |
![]() |
![]() |
#4 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,680
Karma: 23983815
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
Spoiler:
The line number is hard-coded in the following line: Code:
value = text[13]
|
|
![]() |
![]() |
![]() |
#5 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,303
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
Awesome - I'm continually amazed at the level of genius-ery that exists around here!!
![]() I think the next step would be to create a plugin that write's plugin's to order.... anyone want to be a bazillionair??? |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Junior Member
![]() Posts: 7
Karma: 10
Join Date: Mar 2016
Device: Kindle Fire 7"
|
Thanks Guys!
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
EPUB to PDF: hyperlinks that span lines make all of both lines clickable | metallserge | Conversion | 4 | 09-23-2021 06:39 AM |
Glo one book added and one deletes | intipuss | Kobo Reader | 4 | 03-12-2013 10:02 PM |
Touch Dark lines between lines of text | taming | Kobo Reader | 12 | 06-13-2011 07:20 PM |
Save deletes most of the book | PKFFW | Sigil | 3 | 04-20-2010 02:48 AM |
K2 self-deletes 2 books at once | BarryTX | Amazon Kindle | 14 | 04-09-2010 03:30 PM |