I often edit a file locally then cut and paste it into a remote ssh session inside a vi session.
The first step is to delete the entire contents by doing something like
Which will delete up to 9999 lines of the file.
Now somehow the version of vi on a certain ubuntu machine running 14.04 LTS is behaving differently: it is not allowing the above command if the file does not actually contain at least 9999 rows.
How do I re-enable the former /familiar behavior - in which all lines in the entire file would be erased if N (9999 in this case) exceeds the file line count?
UPDATE I appreciate answers coming in for alternative methods to achieve this. However that does not explain why/how/when the behavior changed (I have used Ndd successfully for years. Maybe not the optimal way to do it. But it does work - including on ubuntu - various versions, centos, os/x).
Another update The ":" in front was removed : we are in normal mode. It STILL DOES NOT WORK in this particular editor/vi instance - whereas it works with say 99dd (since the file has > 99 lines) and also doing the same action 9999dd works in other instances.