001package org.unix4j.unix.sed; 002 003import org.unix4j.unix.Sed; 004 005/** 006 * Options for the {@link Sed sed} command with the 007 * the following options: 008 * <p> 009 * <table> 010 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -n}</td><td> </td><td nowrap="nowrap">{@code --quiet}</td><td> </td><td>Suppress the default output (in which each line, after it is 011 examined for editing, is written to standard output). Only lines 012 explicitly selected for output are written.</td></tr> 013 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -g}</td><td> </td><td nowrap="nowrap">{@code --global}</td><td> </td><td>Globally substitute for all non-overlapping instances of the regexp 014 rather than just the first one. 015 <p> 016 (This option is ignored if the occurrence operand is specified).</td></tr> 017 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -p}</td><td> </td><td nowrap="nowrap">{@code --print}</td><td> </td><td>Write the matched line to standard output.</td></tr> 018 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -l}</td><td> </td><td nowrap="nowrap">{@code --lineNumber}</td><td> </td><td>Writes the current line number on a separate line to the standard 019 output.</td></tr> 020 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -I}</td><td> </td><td nowrap="nowrap">{@code --ignoreCase}</td><td> </td><td>Use case insensitive pattern matching.</td></tr> 021 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -s}</td><td> </td><td nowrap="nowrap">{@code --substitute}</td><td> </td><td>Substitutes the replacement string for instances of the regexp in 022 the matched line. 023 <p> 024 An ampersand ('&') appearing in the replacement is be replaced 025 by the line matching the regexp. The characters "\n", where n is a 026 digit, are replaced by the text matched by the corresponding 027 backreference expression. The special meaning of '&' and "\n" 028 in this context can be suppressed by preceding it by a backslash. 029<p> 030 A line can be split by substituting a newline ('\n') into it. 031 <p> 032 A substitution is considered to have been performed even if the 033 replacement string is identical to the string that it replaces.</td></tr> 034 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -a}</td><td> </td><td nowrap="nowrap">{@code --append}</td><td> </td><td>Append string2 as a separate line after the matched line.</td></tr> 035 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -i}</td><td> </td><td nowrap="nowrap">{@code --insert}</td><td> </td><td>Insert string2 as a separate line before the matched line.</td></tr> 036 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -c}</td><td> </td><td nowrap="nowrap">{@code --change}</td><td> </td><td>Write string2 as a separate line instead of the matched line.</td></tr> 037 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -d}</td><td> </td><td nowrap="nowrap">{@code --delete}</td><td> </td><td>Delete the matched line.</td></tr> 038 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -y}</td><td> </td><td nowrap="nowrap">{@code --translate}</td><td> </td><td>Replace all occurrences of characters in string1 with the 039 corresponding characters in string2. If the number of characters in 040 the two strings are not equal, or if any of the characters in 041 string1 appear more than once, the results are undefined.</td></tr> 042 * </table> 043 * <p> 044 * This class serves as entry point to every possible set of {@code sed} options 045 * defined as an enum constant. With this explicit expansion of all possible 046 * option combinations, options can be passed to the command in a very compact 047 * form, such as: 048 * <pre> 049 * sed(Sed.Options.n, ...); 050 * sed(Sed.Options.n.g, ...); 051 * ... 052 * sed(Sed.Options.n.g.p.l.I.s.a.i.c.d.y, ...); 053 * </pre> 054 */ 055public final class SedOptionSets { 056 /** 057 * The singleton instance. 058 */ 059 public static final SedOptionSets INSTANCE = new SedOptionSets(); 060 061 /** 062 * Option {@code "-a"}: Append string2 as a separate line after the matched line. 063 * <p> 064 * The option {@code "-a"} is equivalent to the {@code "--}{@link #append append}{@code "} option. 065 */ 066 public final SedOptionSet_Iaglnp a = SedOptionSet_Iaglnp.Active_a; 067 /** 068 * Option {@code "--append"}: Append string2 as a separate line after the matched line. 069 * <p> 070 * The option {@code "--append"} is equivalent to the {@code "-}{@link #a a}{@code "} option. 071 */ 072 public final SedOptionSet_Iaglnp append = SedOptionSet_Iaglnp.Active_a_long; 073 /** 074 * Option {@code "-c"}: Write string2 as a separate line instead of the matched line. 075 * <p> 076 * The option {@code "-c"} is equivalent to the {@code "--}{@link #change change}{@code "} option. 077 */ 078 public final SedOptionSet_Icglnp c = SedOptionSet_Icglnp.Active_c; 079 /** 080 * Option {@code "--change"}: Write string2 as a separate line instead of the matched line. 081 * <p> 082 * The option {@code "--change"} is equivalent to the {@code "-}{@link #c c}{@code "} option. 083 */ 084 public final SedOptionSet_Icglnp change = SedOptionSet_Icglnp.Active_c_long; 085 /** 086 * Option {@code "-d"}: Delete the matched line. 087 * <p> 088 * The option {@code "-d"} is equivalent to the {@code "--}{@link #delete delete}{@code "} option. 089 */ 090 public final SedOptionSet_Idglnp d = SedOptionSet_Idglnp.Active_d; 091 /** 092 * Option {@code "--delete"}: Delete the matched line. 093 * <p> 094 * The option {@code "--delete"} is equivalent to the {@code "-}{@link #d d}{@code "} option. 095 */ 096 public final SedOptionSet_Idglnp delete = SedOptionSet_Idglnp.Active_d_long; 097 /** 098 * Option {@code "-g"}: Globally substitute for all non-overlapping instances of the regexp 099 rather than just the first one. 100 <p> 101 (This option is ignored if the occurrence operand is specified). 102 * <p> 103 * The option {@code "-g"} is equivalent to the {@code "--}{@link #global global}{@code "} option. 104 */ 105 public final SedOptionSet_Iacdgilnpsy g = SedOptionSet_Iacdgilnpsy.Active_g; 106 /** 107 * Option {@code "--global"}: Globally substitute for all non-overlapping instances of the regexp 108 rather than just the first one. 109 <p> 110 (This option is ignored if the occurrence operand is specified). 111 * <p> 112 * The option {@code "--global"} is equivalent to the {@code "-}{@link #g g}{@code "} option. 113 */ 114 public final SedOptionSet_Iacdgilnpsy global = SedOptionSet_Iacdgilnpsy.Active_g_long; 115 /** 116 * Option {@code "-I"}: Use case insensitive pattern matching. 117 * <p> 118 * The option {@code "-I"} is equivalent to the {@code "--}{@link #ignoreCase ignoreCase}{@code "} option. 119 */ 120 public final SedOptionSet_Iacdgilnpsy I = SedOptionSet_Iacdgilnpsy.Active_I; 121 /** 122 * Option {@code "--ignoreCase"}: Use case insensitive pattern matching. 123 * <p> 124 * The option {@code "--ignoreCase"} is equivalent to the {@code "-}{@link #I I}{@code "} option. 125 */ 126 public final SedOptionSet_Iacdgilnpsy ignoreCase = SedOptionSet_Iacdgilnpsy.Active_I_long; 127 /** 128 * Option {@code "-i"}: Insert string2 as a separate line before the matched line. 129 * <p> 130 * The option {@code "-i"} is equivalent to the {@code "--}{@link #insert insert}{@code "} option. 131 */ 132 public final SedOptionSet_Igilnp i = SedOptionSet_Igilnp.Active_i; 133 /** 134 * Option {@code "--insert"}: Insert string2 as a separate line before the matched line. 135 * <p> 136 * The option {@code "--insert"} is equivalent to the {@code "-}{@link #i i}{@code "} option. 137 */ 138 public final SedOptionSet_Igilnp insert = SedOptionSet_Igilnp.Active_i_long; 139 /** 140 * Option {@code "-l"}: Writes the current line number on a separate line to the standard 141 output. 142 * <p> 143 * The option {@code "-l"} is equivalent to the {@code "--}{@link #lineNumber lineNumber}{@code "} option. 144 */ 145 public final SedOptionSet_Iacdgilnpsy l = SedOptionSet_Iacdgilnpsy.Active_l; 146 /** 147 * Option {@code "--lineNumber"}: Writes the current line number on a separate line to the standard 148 output. 149 * <p> 150 * The option {@code "--lineNumber"} is equivalent to the {@code "-}{@link #l l}{@code "} option. 151 */ 152 public final SedOptionSet_Iacdgilnpsy lineNumber = SedOptionSet_Iacdgilnpsy.Active_l_long; 153 /** 154 * Option {@code "-p"}: Write the matched line to standard output. 155 * <p> 156 * The option {@code "-p"} is equivalent to the {@code "--}{@link #print print}{@code "} option. 157 */ 158 public final SedOptionSet_Iacdgilnpsy p = SedOptionSet_Iacdgilnpsy.Active_p; 159 /** 160 * Option {@code "--print"}: Write the matched line to standard output. 161 * <p> 162 * The option {@code "--print"} is equivalent to the {@code "-}{@link #p p}{@code "} option. 163 */ 164 public final SedOptionSet_Iacdgilnpsy print = SedOptionSet_Iacdgilnpsy.Active_p_long; 165 /** 166 * Option {@code "-n"}: Suppress the default output (in which each line, after it is 167 examined for editing, is written to standard output). Only lines 168 explicitly selected for output are written. 169 * <p> 170 * The option {@code "-n"} is equivalent to the {@code "--}{@link #quiet quiet}{@code "} option. 171 */ 172 public final SedOptionSet_Iacdgilnpsy n = SedOptionSet_Iacdgilnpsy.Active_n; 173 /** 174 * Option {@code "--quiet"}: Suppress the default output (in which each line, after it is 175 examined for editing, is written to standard output). Only lines 176 explicitly selected for output are written. 177 * <p> 178 * The option {@code "--quiet"} is equivalent to the {@code "-}{@link #n n}{@code "} option. 179 */ 180 public final SedOptionSet_Iacdgilnpsy quiet = SedOptionSet_Iacdgilnpsy.Active_n_long; 181 /** 182 * Option {@code "-s"}: Substitutes the replacement string for instances of the regexp in 183 the matched line. 184 <p> 185 An ampersand ('&') appearing in the replacement is be replaced 186 by the line matching the regexp. The characters "\n", where n is a 187 digit, are replaced by the text matched by the corresponding 188 backreference expression. The special meaning of '&' and "\n" 189 in this context can be suppressed by preceding it by a backslash. 190<p> 191 A line can be split by substituting a newline ('\n') into it. 192 <p> 193 A substitution is considered to have been performed even if the 194 replacement string is identical to the string that it replaces. 195 * <p> 196 * The option {@code "-s"} is equivalent to the {@code "--}{@link #substitute substitute}{@code "} option. 197 */ 198 public final SedOptionSet_Iglnps s = SedOptionSet_Iglnps.Active_s; 199 /** 200 * Option {@code "--substitute"}: Substitutes the replacement string for instances of the regexp in 201 the matched line. 202 <p> 203 An ampersand ('&') appearing in the replacement is be replaced 204 by the line matching the regexp. The characters "\n", where n is a 205 digit, are replaced by the text matched by the corresponding 206 backreference expression. The special meaning of '&' and "\n" 207 in this context can be suppressed by preceding it by a backslash. 208<p> 209 A line can be split by substituting a newline ('\n') into it. 210 <p> 211 A substitution is considered to have been performed even if the 212 replacement string is identical to the string that it replaces. 213 * <p> 214 * The option {@code "--substitute"} is equivalent to the {@code "-}{@link #s s}{@code "} option. 215 */ 216 public final SedOptionSet_Iglnps substitute = SedOptionSet_Iglnps.Active_s_long; 217 /** 218 * Option {@code "-y"}: Replace all occurrences of characters in string1 with the 219 corresponding characters in string2. If the number of characters in 220 the two strings are not equal, or if any of the characters in 221 string1 appear more than once, the results are undefined. 222 * <p> 223 * The option {@code "-y"} is equivalent to the {@code "--}{@link #translate translate}{@code "} option. 224 */ 225 public final SedOptionSet_Iglnpy y = SedOptionSet_Iglnpy.Active_y; 226 /** 227 * Option {@code "--translate"}: Replace all occurrences of characters in string1 with the 228 corresponding characters in string2. If the number of characters in 229 the two strings are not equal, or if any of the characters in 230 string1 appear more than once, the results are undefined. 231 * <p> 232 * The option {@code "--translate"} is equivalent to the {@code "-}{@link #y y}{@code "} option. 233 */ 234 public final SedOptionSet_Iglnpy translate = SedOptionSet_Iglnpy.Active_y_long; 235 236}