On Wed, Jul 21, 2021 at 12:18 PM <revcomni...@gmail.com> wrote: > > In ed I have a cleanup script which I can apply to several files at once. The > script removes things like blank lines and spaces between words. To run it on > a file or multiple files, I type this command: > ed [name of file(s)] < cleanup-script > I converted all the regular expressions in the file into sam regex format and > tried the same, but to no avail. Here is a list of some of the commands: > > .x s/\*//g > ,x/^ +/s/// > ,x/ +$/s/// > ,x/ +/s// / > ,x/^$\n/d > ,x/‘‘|’’/s//"/ > ,x/“|”/s//"/ > ,x/‘|’/s//"/ > ,x/^ +/s/// > ,x/ +$/s/// > ,x/ +/s// / > ,x/^$\n/d > ,x/‘‘|’’/s//"/ > ,x/“|”/s//"/ > ,x/‘|’/s//"/ > ,x/teh/c/the/ > wq > > I am not even sure sam can do this, but if it can, I would appreciate some > guidance on how to do it. > > > 9fans / 9fans / see discussions + participants + delivery options Permalink
As far as having sam commands apply to multiple files, the X command is there: sam(1): X/regexp/ command For each file whose menu entry matches the regular expression, make that the current file and run the command. If the expression is omitted, the command is run in every file. Given these target files: grep . file[12] file1:line1 file2:line2 And a file that contains some sam commands: cat cmd X ,p q The following output is printed: sam -d file[12] <cmd -. file1 line1 - file2 line2 ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-Mbddcbb3fb3e41229d32d0ca7 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription