Batch editing files with ed
jvns.ca
Batch editing files with ed
1–10 of 78 posts
Re: Batch editing files with ed
#2Re: Batch editing files with ed
#3Re: Batch editing files with ed
#4 :args file1.txt file2.txt file3.txt
:set autowrite
:argdo norm /- baz/yypwCelephants
The commands set the argument list to a list of three files (by default, it is set to the filenames you passed to vim on the command-line). Then, autowrite is enabled which automatically saves each buffer after editing it. Finally, argdo runs a command on each argument file.Re: Batch editing files with ed
#5Re: Batch editing files with ed
#6Re: Batch editing files with ed
#7After spending 5 minutes with the manual, I realized it was the best line editor I've ever used.
ed is very similar, but it doesn't come with a nice manual. The info page is chaotic and doesn't start from the beginning. You can cover typical usage in 5 lines, but no, you have to read through 25 pages of stuff just to figure out a sensible command. I just use vim or nano.
Re: Batch editing files with ed
#8 sed s/baz/baz\\nelephants/Re: Batch editing files with ed
#9I've recently used EDLIN from an 80s version of MS-DOS. After spending 5 minutes with the manual, I realized it was the best line editor I've ever used. ed is very similar, but it doesn't come with a nice manual. The info page is chaotic and doesn't start from the beginning. You can cover typical usage in 5 lines, but no, you have to read through 25 pages of stuff just to figure out a sensible command. I just use vim…
Re: Batch editing files with ed
#10In practice I often use Vim instead. :args file1.txt file2.txt file3.txt :set autowrite :argdo norm /- baz/ yypwCelephants The commands set the argument list to a list of three files (by default, it is set to the filenames you passed to vim on the command-line). Then, autowrite is enabled which automatically saves each buffer after editing it. Finally, argdo runs a command on each argument file.