Looking for a multiple editor

Linux for blind general discussion blinux-list at redhat.com
Wed Mar 30 15:01:30 UTC 2022

Tim here.  You can make batch-changes to files with sed, ed, or
vi/vim (and likely many others, but those are the ones I use).

You don't detail what sorts of changes you need to make, so it's hard
to provide a more complete solution, but some examples:

- if you want to just do a word-substitution through all of your
  files like changing "John" to "Tim", you can use

   sed -i.bak 's/John/Tim/g' *.txt

  Note that it might over-reach changing things like "Johnson" to

- if you want to move a line *down* in a file, you can also use sed,
  but if you have multiple manipulations (or want to move things
  *up* in a file) you want to execute, you want to reach for one of
  the others I listed.  E.g. if you want to move all the lines from
  the last line containing "Chapter" through the end of the file up
  to the top of your file, you can do it with

   for f in *.txt; do printf '1\n?Chapter?,$m0\nwq\n' | ed -s "$f" ; done

  which goes to the first line in each file, searches backwards for
  "Chapter", then from there through the end of the file ("$"), moves
  ("m") those lines to the beginning of the file (after line 0)

- if your changes are more complex, vim has some very powerful tools
  for manipulating and scripting across all the files you open with
  it,  using the ":bufdo" or ":argdo" command.

I do these sorts of edits all the time, so if you have more details
on the sorts of changes you want to make, I can gladly whip up some
more usable answer.


On March 30, 2022, Linux for blind general discussion wrote:
> I have a number of texts in which I wish to make alterations that
> are the same for all of them. I think that there is a linux program
> in which I can list the alterations and them have them made. but I
> can't remember what it is called. Please refresh my memory.
> thanks,
> John
> -- 
> John J. Boyer
> Email: john.boyer at abilitiessoft.org
> website: http://www.abilitiessoft.org
> Status: Company dissolved but website and email addresses  live.
> Location: Madison, Wisconsin, USA
> Mission: developing assistive technology software and providing
> STEM services that are available at no cost
> _______________________________________________
> Blinux-list mailing list
> Blinux-list at redhat.com
> https://listman.redhat.com/mailman/listinfo/blinux-list

More information about the Blinux-list mailing list