I am trying to process a series of files. I have noticed that there are discrepancies in running a particular command from the command line (i.e. ex mode). E.g.
$cat poo.txt
big
red
dog
small
black
cat
$vim -c "2,$g/^dog/d|wq" poo.txt
$cat poo.txt
big
small
black
cat
It appears that 2,$g/^dog/d|wq has deleted the lines with red and dog. This confuses me because the command should : start on line 2 (going to EOF) and delete all lines beginning with dog. In this instance, I'd expect the output to be:
$ cat poo.txt
big
red
small
black
cat
In fact, if I try this in the vim editor this is the exact behavior that is observed.
QUESTION: What is cause of the discrepancy between the vim -c version and the vim version of running this command?