

© Copyright 1996 University of Washington Computing & Communications. Of the file to the current cursor position :^.s/old/new/g Substitutes old with new from the beginning ,$s/old/new/g Substitutes old with new from the current It might be that 1996 site or one of the many other who copied/pasted these lines without double checking. The site where you found this vicommand is wrong. As in any other implementation of ed, - or -1 may still be used as an alternative. Just to provide another piece of trivia: The ^ address can also not be used in the GNU implementation of the ed editor. The ^-instead-of- 1 typo could possibly come from thinking that "since $ is the end-of-line anchor in regular expressions, and also the address of the last line in the editing buffer, ^, being the start-of-line anchor in regular expressions, must therefore (by symmetry) be the first line of the editing buffer". To address all lines from the start of the editing buffer to the current line, use 1.

It only addresses the previous and the current line, and only does so in "historically accurate" implementations of vi (and ex and ed). addresses all lines from the top of the file to the current line. Note that the text that you seem to be quoting says that ^. POSIX.1-2017 does not require or prohibit this behavior. In both cases it was identical to the - character.

Historically, ex and vi accepted the ^ character as both an address and as a flag offset for commands. There is a similar wording for the vi and ex editors ( ex is vi "in line editor mode"):

Historically, ed accepted the ^ character as an address, in which case it was identical to the character. The POSIX standard says the following about this in relation to the ed editor: Using - or -1 in place of ^ also works in ed, ex and in vi on non-GNU systems. You may use - or -1 in its place: -.s/old/new/g The vim editor, being an extended re-implementation of the original vi and ex editors, commonly installed on Linux systems under the names vim, vi, and ex, does not have this way of addressing the previous line, and will respond with " E492: Not an editing command" if you try to use it. would swap this line with the previous, and that ^.s/old/new/g would substitute all strings matching old with new on the previous line and on this line. This means that the command ^d would delete the previous line, ^m. Reference: the vi editor, as well as in both ex and ed (as found on BSD systems), the ^ addresses the previous line. the default directory when first logging pwd
