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