Sample Header Ad - 728x90

Running an ed script from within ed

2 votes
2 answers
1075 views
I have created a script file called "cleanup" which contains a series of regular expressions that clean up an ed file(s) of blank spaces, trailing white-space, blank lines etc. I run it as follows: ed [name-of-file] < [name-of-script] I sometimes want to run the script on the file I am currently editing from within ed. I am unsure of the syntax I would need to do that. Here is an example script: g/^ */s/// # Remove blank spaces at the beginning of a line g/ *$/s/// # Remove trailing whitespace at end of line g/ */s// /g # Remove additional spaces between words g/^$/d # delete blank lines g/\(‘‘\|’’\)/s//"/g # Remove curly braces g/\(“\|”\)/s//"/g g/\(‘\|’\)/s//'/g # idem ,p Q
Asked by edman (588 rep)
Jul 14, 2021, 02:56 PM
Last activity: May 5, 2025, 10:50 PM