POSIX (63302) | POSIX (222178) |
---|---|
1$FreeBSD: head/bin/ed/POSIX 63302 2000-07-17 10:40:48Z sheldonh $ | 1$FreeBSD: head/bin/ed/POSIX 222178 2011-05-22 14:03:46Z uqs $ |
2 3This version of ed(1) is not strictly POSIX compliant, as described in 4the POSIX 1003.2 document. The following is a summary of the omissions, 5extensions and possible deviations from POSIX 1003.2. 6 7OMISSIONS 8--------- 91) For backwards compatibility, the POSIX rule that says a range of --- 60 unchanged lines hidden (view full) --- 70 Similarly, to remove a newline from the end of binary `file': 71 $ ed file 72 r /dev/null 73 wq 74 752) Since the behavior of `u' (undo) within a `g' (global) command list is 76 not specified by POSIX, it follows the behavior of the SunOS ed: 77 undo forces a global command list to be executed only once, rather than | 2 3This version of ed(1) is not strictly POSIX compliant, as described in 4the POSIX 1003.2 document. The following is a summary of the omissions, 5extensions and possible deviations from POSIX 1003.2. 6 7OMISSIONS 8--------- 91) For backwards compatibility, the POSIX rule that says a range of --- 60 unchanged lines hidden (view full) --- 70 Similarly, to remove a newline from the end of binary `file': 71 $ ed file 72 r /dev/null 73 wq 74 752) Since the behavior of `u' (undo) within a `g' (global) command list is 76 not specified by POSIX, it follows the behavior of the SunOS ed: 77 undo forces a global command list to be executed only once, rather than |
78 for each line matching a global pattern. In addtion, each instance of | 78 for each line matching a global pattern. In addition, each instance of |
79 `u' within a global command undoes all previous commands (including 80 undo's) in the command list. This seems the best way, since the 81 alternatives are either too complicated to implement or too confusing 82 to use. 83 84 The global/undo combination is useful for masking errors that 85 would otherwise cause a script to fail. For instance, an ed script | 79 `u' within a global command undoes all previous commands (including 80 undo's) in the command list. This seems the best way, since the 81 alternatives are either too complicated to implement or too confusing 82 to use. 83 84 The global/undo combination is useful for masking errors that 85 would otherwise cause a script to fail. For instance, an ed script |
86 to remove any occurences of either `censor1' or `censor2' might be | 86 to remove any occurrences of either `censor1' or `censor2' might be |
87 written as: 88 ed - file <<EOF 89 1g/.*/u\ 90 ,s/censor1//g\ 91 ,s/censor2//g 92 ... 93 943) The `m' (move) command within a `g' command list also follows the SunOS 95 ed implementation: any moved lines are removed from the global command's 96 `active' list. 97 984) If ed is invoked with a name argument prefixed by a bang (!), then the 99 remainder of the argument is interpreted as a shell command. To invoke 100 ed on a file whose name starts with bang, prefix the name with a 101 backslash. | 87 written as: 88 ed - file <<EOF 89 1g/.*/u\ 90 ,s/censor1//g\ 91 ,s/censor2//g 92 ... 93 943) The `m' (move) command within a `g' command list also follows the SunOS 95 ed implementation: any moved lines are removed from the global command's 96 `active' list. 97 984) If ed is invoked with a name argument prefixed by a bang (!), then the 99 remainder of the argument is interpreted as a shell command. To invoke 100 ed on a file whose name starts with bang, prefix the name with a 101 backslash. |