Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #270567
| From | Michael Kjörling <c9bc136c6063@ewoof.net> |
|---|---|
| Newsgroups | linux.debian.user |
| Subject | Re: Need help with narroely focused use case of Emacs |
| Date | 2024-06-28 23:00 +0200 |
| Message-ID | <IUqRj-6hMu-1@gated-at.bofh.it> (permalink) |
| References | <IUp8S-6gVm-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 28 Jun 2024 14:04 -0500, from rowlett@access.net (Richard Owlett): > I need to replace ANY occurrence of > <span class="verse" id="V1"> > thru [at most] > <span class="verse" id="V119"> > by > <sup> > > I'm reformatting a Bible stored in HTML format for a particular set of > vision impaired seniors (myself included). Each chapter is in its own file. > > How do I open a file. > Do the above replacement. > Save and close the file. Ignoring the question about Emacs and focusing on the goal (your question otherwise is an excellent example of a XY question), this is not something regular expressions are very good at. However, since it's presumably a once-only operation, I assume that you can live with it being done in a suboptimal way in terms of performance. In that case, assuming for simplicity that all the files are in a single directory, you could try something similar to: $ for v in $(seq 1 119); do sed -i 's,<span class="verse" id="V'$v'">,<sup>,g' ./*.html; done Be sure to have a copy in case something goes wrong; and diff(1) a few files afterwards to make sure that the result is as you intended. Yes, it almost certainly can be done with a single sed (or other similar tool) invocation where the regular expression matches precisely what you want it to match. But unless this is something you will do very often, I tend to prefer readability over being clever, even if the readable version is somewhat less performant. -- Michael Kjörling 🔗 https://michael.kjorling.se “Remember when, on the Internet, nobody cared that you were a dog?”
Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Need help with narroely focused use case of Emacs Richard Owlett <rowlett@access.net> - 2024-06-28 21:10 +0200
Re: Need help with narroely focused use case of Emacs didier gaumet <didier.gaumet@gmail.com> - 2024-06-28 21:20 +0200
Re: Need help with narroely focused use case of Emacs <tomas@tuxteam.de> - 2024-06-29 07:00 +0200
Re: Need help with narroely focused use case of Emacs Richard Owlett <rowlett@access.net> - 2024-06-29 12:10 +0200
Re: Need help with narroely focused use case of Emacs Michael Kjörling <c9bc136c6063@ewoof.net> - 2024-06-28 23:00 +0200
Re: Need help with narroely focused use case of Emacs Charles Curley <charlescurley@charlescurley.com> - 2024-06-29 05:30 +0200
Re: Need help with narroely focused use case of Emacs Richard Owlett <rowlett@access.net> - 2024-06-29 13:20 +0200
Re: Need help with narroely focused use case of Emacs Michael Kjörling <c9bc136c6063@ewoof.net> - 2024-06-29 15:50 +0200
Re: Need help with narroely focused use case of Emacs Andy Smith <andy@strugglers.net> - 2024-06-29 16:20 +0200
Re: Need help with narroely focused use case of Emacs Lee <ler762@gmail.com> - 2024-06-29 18:10 +0200
Re: Need help with narroely focused use case of Emacs Greg Wooledge <greg@wooledge.org> - 2024-06-29 14:50 +0200
Re: Need help with narroely focused use case of Emacs Richard Owlett <rowlett@access.net> - 2024-06-29 13:00 +0200
Re: Need help with narroely focused use case of Emacs debian-user@howorth.org.uk - 2024-06-29 14:00 +0200
Re: Need help with narroely focused use case of Emacs Richard Owlett <rowlett@access.net> - 2024-06-29 15:00 +0200
Re: Need help with narroely focused use case of Emacs Dan Ritter <dsr@randomstring.org> - 2024-06-29 14:10 +0200
Re: Need help with narroely focused use case of Emacs Greg Wooledge <greg@wooledge.org> - 2024-06-29 15:00 +0200
Re: Need help with narroely focused use case of Emacs Michael Kjörling <c9bc136c6063@ewoof.net> - 2024-06-29 15:50 +0200
Re: Need help with narroely focused use case of Emacs Curt <curty@free.fr> - 2024-06-29 18:10 +0200
Re: Need help with narroely focused use case of Emacs <tomas@tuxteam.de> - 2024-06-29 19:00 +0200
Re: Need help with narroely focused use case of Emacs Curt <curty@free.fr> - 2024-06-29 19:50 +0200
Curt having his fits [was: Need help with narroely focused use case of Emacs] <tomas@tuxteam.de> - 2024-06-29 20:00 +0200
Re: Curt having his fits [was: Need help with narroely focused use case of Emacs] Curt <curty@free.fr> - 2024-06-29 20:50 +0200
Re: Curt having his fits [was: Need help with narroely focused use case of Emacs] Richard <rrosner5@gmail.com> - 2024-06-30 01:00 +0200
Re: Curt having his fits [was: Need help with narroely focused use case of Emacs] Greg Wooledge <greg@wooledge.org> - 2024-06-30 01:10 +0200
Re: Curt having his fits [was: Need help with narroely focused use case of Emacs] Will Mengarini <seldon@eskimo.com> - 2024-06-30 01:40 +0200
Re: Curt having his fits Geert Stappers <stappers@stappers.nl> - 2024-06-30 11:50 +0200
Eric Naggum [was: Curt having his fits] <tomas@tuxteam.de> - 2024-06-30 14:00 +0200
Re: Need help with narroely focused use case of Emacs Vincent Lefevre <vincent@vinc17.net> - 2024-06-29 17:10 +0200
Re: Need help with narroely focused use case of Emacs David Wright <deblis@lionunicorn.co.uk> - 2024-06-29 21:00 +0200
Re: Need help with narroely focused use case of Emacs <tomas@tuxteam.de> - 2024-06-29 06:50 +0200
Re: Need help with narroely focused use case of Emacs Richard Owlett <rowlett@access.net> - 2024-06-29 13:40 +0200
Re: Need help with narroely focused use case of Emacs <tomas@tuxteam.de> - 2024-06-29 19:20 +0200
Solution [Re: Need help with narroely focused use case of Emacs] Richard Owlett <rowlett@access.net> - 2024-07-05 14:10 +0200
Re: Need help with narroely focused use case of Emacs Max Nikulin <manikulin@gmail.com> - 2024-06-29 13:40 +0200
Re: Need help with narroely focused use case of Emacs Max Nikulin <manikulin@gmail.com> - 2024-06-29 17:10 +0200
Re: Need help with narroely focused use case of Emacs Greg Wooledge <greg@wooledge.org> - 2024-06-29 21:30 +0200
Re: Need help with narroely focused use case of Emacs Greg Wooledge <greg@wooledge.org> - 2024-06-30 15:30 +0200
Re: Need help with narroely focused use case of Emacs Andy Smith <andy@strugglers.net> - 2024-06-30 16:00 +0200
Re: Need help with narroely focused use case of Emacs Richard Owlett <rowlett@access.net> - 2024-06-29 12:10 +0200
csiph-web