People use the ed editor with script files to make global edits. But many versions of ed can't edit large files. The ex editor is usually better, but it has limits, too. How large is "large"? That depends on your version. Most eds I've seen can't handle more than about 100,000 characters.
There are no limits on, although you'll need to , and your editing script may have to be changed to work with sed.  Here's what you'll see when ed bombs:
 By default, ed commands apply to the current line. sed commands are global. Also, relative line addresses like
-5don't work in sed.
cat edscrs/Unix/UNIX/g w %
ed - words < edscr? %
? is ed's verbose way of telling you that
something's wrong. This obscure message is especially bad if you
write a shell script that edits multiple files in a loop; you may not
notice the error or be able to tell which file had the problem. Be
sure your script checks for errors!
Unfortunately for programmers, ed may not return an error status
that you can test.
ed - command succeeds, it doesn't display
anything. The simplest way to find errors is to check for any output
on stdout or stderr. This chunk of a Bourne shell script
shows how (your filename is in the
edout="`ed - $filename < edscr 2>&1`" if [ -n "$edout" -o $? -ne 0 ] then echo "$edout" 1>&2 echo "QUITTING: 'ed - $filename < edscr' bombed?!?" 1>&2 exit 1 fi
|33.7 ed/ex Batch Edits: Avoid Errors When No Match||33.9 patch: Generalized Updating of Files that Differ|