001package org.unix4j; 002 003import org.unix4j.builder.Unix4jCommandBuilder; 004import org.unix4j.builder.DefaultUnix4jCommandBuilder; 005import org.unix4j.command.NoOp; 006import org.unix4j.context.ExecutionContextFactory; 007 008import org.unix4j.unix.cat.CatOptions; 009import org.unix4j.unix.echo.EchoOptions; 010import org.unix4j.unix.find.FindOptions; 011import org.unix4j.unix.grep.GrepOptions; 012import org.unix4j.unix.head.HeadOptions; 013import org.unix4j.unix.ls.LsOptions; 014import org.unix4j.unix.sed.SedOptions; 015import org.unix4j.unix.sort.SortOptions; 016import org.unix4j.unix.tail.TailOptions; 017import org.unix4j.unix.uniq.UniqOptions; 018import org.unix4j.unix.wc.WcOptions; 019 020/** 021 * Utility class with static methods serving as starting point to create a 022 * command or build a command chain joining several commands. 023 * <p> 024 * Every method returns a new builder instance. For more information and a 025 * detailed description of command building and chaining, see 026 * {@link Unix4jCommandBuilder}. 027 */ 028public final class Unix4j { 029 030 /** 031 * Returns a builder to create a command or command chain. The builder is 032 * initialized with a {@link NoOp} command which will be replaced by the 033 * first command joined to this builder's command chain. 034 * 035 * @return the builder to create the command or command chain 036 */ 037 public static Unix4jCommandBuilder builder() { 038 return new DefaultUnix4jCommandBuilder(); 039 } 040 041 /** 042 * Returns a builder that uses the specified factory to create contexts for 043 * command execution. The builder is initialized with a {@link NoOp} command 044 * which will be replaced by the first command joined to this builder's 045 * command chain. 046 * 047 * @param contextFactory 048 * the factory used to create execution contexts that are passed 049 * to the execute method when a command is executed 050 * @return the builder to create the command or command chain 051 */ 052 public static Unix4jCommandBuilder use(ExecutionContextFactory contextFactory) { 053 return new DefaultUnix4jCommandBuilder(contextFactory); 054 } 055 056 /** 057 * Reads the lines from files specified as arguments and writes them to 058 the standard output. Options can be specified by acronym (with a 059 leading dash "-") or by long name (with two leading dashes "--"). 060 File arguments are expanded if wildcards are used. All file 061 arguments are processed in command-argument order. 062 * <p> 063 * Note that the method returns the command builder to allow for command 064 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 065 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 066 * 067 * @param args String arguments defining the options and file operands for the 068 command. Options can be specified by acronym (with a leading dash 069 "-") or by long name (with two leading dashes "--"). File arguments 070 are expanded if wildcards are used. 071 * @return the command builder to allow for method chaining. Method 072 * chaining is used here to create command chains. Adding a command 073 * to the chain usually means that the previous command <i>pipes</i> 074 * its output to the added command (the pipe symbol in unix) 075 */ 076 public static Unix4jCommandBuilder cat(String... args) { 077 return builder().cat(args); 078 } 079 /** 080 * Reads the lines from the specified files and writes them to the 081 standard output. The files are processed in command-argument order. 082 * <p> 083 * Note that the method returns the command builder to allow for command 084 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 085 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 086 * 087 * @param files The input files to be printed; relative paths are not resolved (use 088 the string path argument to enable relative path resolving based on 089 the current working directory). 090 * @return the command builder to allow for method chaining. Method 091 * chaining is used here to create command chains. Adding a command 092 * to the chain usually means that the previous command <i>pipes</i> 093 * its output to the added command (the pipe symbol in unix) 094 */ 095 public static Unix4jCommandBuilder cat(java.io.File... files) { 096 return builder().cat(files); 097 } 098 /** 099 * Reads the lines from the specified files and writes them to the 100 standard output; the given options define the details of the output 101 format. The files are processed in command-argument order. 102 * <p> 103 * Note that the method returns the command builder to allow for command 104 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 105 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 106 * 107 * @param options Options for the cat command. 108 * @param files The input files to be printed; relative paths are not resolved (use 109 the string path argument to enable relative path resolving based on 110 the current working directory). 111 * @return the command builder to allow for method chaining. Method 112 * chaining is used here to create command chains. Adding a command 113 * to the chain usually means that the previous command <i>pipes</i> 114 * its output to the added command (the pipe symbol in unix) 115 */ 116 public static Unix4jCommandBuilder cat(CatOptions options, java.io.File... files) { 117 return builder().cat(options, files); 118 } 119 /** 120 * Reads the lines from the specified files and writes them to the 121 standard output; the given options define the details of the output 122 format. The path arguments are expanded if wildcards are used and 123 processed in command-argument order. 124 * <p> 125 * Note that the method returns the command builder to allow for command 126 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 127 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 128 * 129 * @param options Options for the cat command. 130 * @param paths Pathnames of the input files to be printed; wildcards * and ? are 131 supported; relative paths are resolved on the basis of the current 132 working directory. 133 * @return the command builder to allow for method chaining. Method 134 * chaining is used here to create command chains. Adding a command 135 * to the chain usually means that the previous command <i>pipes</i> 136 * its output to the added command (the pipe symbol in unix) 137 */ 138 public static Unix4jCommandBuilder cat(CatOptions options, String... paths) { 139 return builder().cat(options, paths); 140 } 141 /** 142 * Changes the current directory to the user home directory as defined 143 by the execution context (usually the directory specified by the 144 {@code "user.home"} system property). 145 * <p> 146 * Note that the method returns the command builder to allow for command 147 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 148 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 149 * 150 * @return the command builder to allow for method chaining. Method 151 * chaining is used here to create command chains. Adding a command 152 * to the chain usually means that the previous command <i>pipes</i> 153 * its output to the added command (the pipe symbol in unix) 154 */ 155 public static Unix4jCommandBuilder cd() { 156 return builder().cd(); 157 } 158 /** 159 * The current working directory is changed to the given file. If the 160 specified file argument does not represent a valid directory, an 161 exception is thrown. Note that relative paths are not resolved with 162 the (old) current working directory. Use the String path to enable 163 relative path resolving and wildcards. 164 * <p> 165 * Note that the method returns the command builder to allow for command 166 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 167 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 168 * 169 * @param file the file to use as input; relative paths are not resolved (use the 170 string path argument to enable relative path resolving based on the 171 current working directory). 172 * @return the command builder to allow for method chaining. Method 173 * chaining is used here to create command chains. Adding a command 174 * to the chain usually means that the previous command <i>pipes</i> 175 * its output to the added command (the pipe symbol in unix) 176 */ 177 public static Unix4jCommandBuilder cd(java.io.File file) { 178 return builder().cd(file); 179 } 180 /** 181 * The current working directory is changed to the given file. Relative 182 paths are resolved on the basis of the (old) current working 183 directory. Wildcards are possible if the first matching file 184 represents a directory. If the first file specified by the given 185 path argument is not a valid directory, an exception is thrown. 186 * <p> 187 * Note that the method returns the command builder to allow for command 188 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 189 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 190 * 191 * @param path the directory to become the new current working directory; 192 wildcards * and ? are supported; relative paths are resolved on the 193 basis of the current working directory. 194 * @return the command builder to allow for method chaining. Method 195 * chaining is used here to create command chains. Adding a command 196 * to the chain usually means that the previous command <i>pipes</i> 197 * its output to the added command (the pipe symbol in unix) 198 */ 199 public static Unix4jCommandBuilder cd(String path) { 200 return builder().cd(path); 201 } 202 /** 203 * Writes any of the specified strings, separated by single blank 204 ({@code ' '}) characters to the standard output suppressing the 205 trailing line ending if the {@code "-n"} option is specified. 206 * <p> 207 * Note that the method returns the command builder to allow for command 208 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 209 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 210 * 211 * @param args String arguments defining the options for the command and the 212 strings to be written to the output. Options can be specified by 213 acronym (with a leading dash "-") or by long name (with two leading 214 dashes "--"). 215 * @return the command builder to allow for method chaining. Method 216 * chaining is used here to create command chains. Adding a command 217 * to the chain usually means that the previous command <i>pipes</i> 218 * its output to the added command (the pipe symbol in unix) 219 */ 220 public static Unix4jCommandBuilder echo(String... args) { 221 return builder().echo(args); 222 } 223 /** 224 * Writes the specified string followed by a newline character to 225 the standard output suppressing the trailing line ending if the 226 {@code -n} option is specified. 227 * <p> 228 * Note that the method returns the command builder to allow for command 229 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 230 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 231 * 232 * @param options Options for the echo command. 233 * @param string A string to be written to standard output. 234 * @return the command builder to allow for method chaining. Method 235 * chaining is used here to create command chains. Adding a command 236 * to the chain usually means that the previous command <i>pipes</i> 237 * its output to the added command (the pipe symbol in unix) 238 */ 239 public static Unix4jCommandBuilder echo(EchoOptions options, String string) { 240 return builder().echo(options, string); 241 } 242 /** 243 * Writes any of the specified strings, separated by single blank 244 ({@code ' '}) characters to the standard output suppressing the 245 trailing line ending if the {@code -n} option is specified. 246 * <p> 247 * Note that the method returns the command builder to allow for command 248 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 249 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 250 * 251 * @param options Options for the echo command. 252 * @param strings Strings to be written to standard output, separated by single blank 253 characters. 254 * @return the command builder to allow for method chaining. Method 255 * chaining is used here to create command chains. Adding a command 256 * to the chain usually means that the previous command <i>pipes</i> 257 * its output to the added command (the pipe symbol in unix) 258 */ 259 public static Unix4jCommandBuilder echo(EchoOptions options, String... strings) { 260 return builder().echo(options, strings); 261 } 262 /** 263 * Finds all files matching the search criteria specified by the given 264 arguments and writes the file names to the standard output. 265 <p> 266 Options can be specified by acronym (with a leading dash "-") or by 267 long name (with two leading dashes "--"). Operands other than the 268 default "--name" operand have to be prefixed with the operand name. 269 <p> 270 The files names written to the output are relative paths referring 271 to the working directory (or -- if provided -- relative to the path 272 given after the {@code "--path"} operand name). 273 * <p> 274 * Note that the method returns the command builder to allow for command 275 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 276 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 277 * 278 * @param args String arguments defining the options and operands for the command. 279 Options can be specified by acronym (with a leading dash "-") or by 280 long name (with two leading dashes "--"). Operands other than the 281 default "--path" operand have to be prefixed with the operand name 282 (e.g. "--name" for subsequent path operand values). 283 * @return the command builder to allow for method chaining. Method 284 * chaining is used here to create command chains. Adding a command 285 * to the chain usually means that the previous command <i>pipes</i> 286 * its output to the added command (the pipe symbol in unix) 287 */ 288 public static Unix4jCommandBuilder find(String... args) { 289 return builder().find(args); 290 } 291 /** 292 * Finds all files in or below the directory specified by {@code path} 293 and writes the file names to the standard output. 294<p> 295 The files names written to the output are paths relative to the 296 specified {@code path} operand. 297 * <p> 298 * Note that the method returns the command builder to allow for command 299 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 300 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 301 * 302 * @param path Starting point for the search in the directory hierarchy; 303 wildcards * and ? are supported; relative paths are resolved on the 304 basis of the current working directory. 305 * @return the command builder to allow for method chaining. Method 306 * chaining is used here to create command chains. Adding a command 307 * to the chain usually means that the previous command <i>pipes</i> 308 * its output to the added command (the pipe symbol in unix) 309 */ 310 public static Unix4jCommandBuilder find(String path) { 311 return builder().find(path); 312 } 313 /** 314 * Finds all files matching the specified {@code name} in or below the 315 directory specified by {@code path} and writes the file names to 316 the standard output. 317 <p> 318 The files names written to the output are paths relative to the 319 specified {@code path} operand. 320 * <p> 321 * Note that the method returns the command builder to allow for command 322 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 323 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 324 * 325 * @param path Starting point for the search in the directory hierarchy; 326 wildcards * and ? are supported; relative paths are resolved on the 327 basis of the current working directory. 328 * @param name Name pattern to match the file name after removing the path with the 329 leading directories; wildcards * and ? are supported, or full 330 regular expressions if either of the options {@code -regex (-r)} or 331 {@code -iregex (-i)} is specified. 332 * @return the command builder to allow for method chaining. Method 333 * chaining is used here to create command chains. Adding a command 334 * to the chain usually means that the previous command <i>pipes</i> 335 * its output to the added command (the pipe symbol in unix) 336 */ 337 public static Unix4jCommandBuilder find(String path, String name) { 338 return builder().find(path, name); 339 } 340 /** 341 * Finds all files matching the specified file {@code size} in or below 342 the user's current working directory and writes the file names to 343 the standard output. Matching files use at least {@code size} bytes 344 on disk if {@code size} is positive, or at most {@code abs(size)} 345 bytes if {@code size} is zero or negative. 346 <p> 347 The files names written to the output are relative paths referring 348 to the working directory. 349 * <p> 350 * Note that the method returns the command builder to allow for command 351 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 352 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 353 * 354 * @param size Consider only files using at least {@code size} bytes if {@code size} 355 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 356 or negative. 357 * @return the command builder to allow for method chaining. Method 358 * chaining is used here to create command chains. Adding a command 359 * to the chain usually means that the previous command <i>pipes</i> 360 * its output to the added command (the pipe symbol in unix) 361 */ 362 public static Unix4jCommandBuilder find(long size) { 363 return builder().find(size); 364 } 365 /** 366 * Finds all files matching the specified file {@code size} in or below 367 the directory specified by {@code path} and writes the file names 368 to the standard output. Matching files use at least {@code size} 369 bytes on disk if {@code size} is positive, or at most 370 {@code abs(size)} bytes if {@code size} is zero or negative. 371<p> 372 The files names written to the output are paths relative to the 373 specified {@code path} operand. 374 * <p> 375 * Note that the method returns the command builder to allow for command 376 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 377 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 378 * 379 * @param path Starting point for the search in the directory hierarchy; 380 wildcards * and ? are supported; relative paths are resolved on the 381 basis of the current working directory. 382 * @param size Consider only files using at least {@code size} bytes if {@code size} 383 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 384 or negative. 385 * @return the command builder to allow for method chaining. Method 386 * chaining is used here to create command chains. Adding a command 387 * to the chain usually means that the previous command <i>pipes</i> 388 * its output to the added command (the pipe symbol in unix) 389 */ 390 public static Unix4jCommandBuilder find(String path, long size) { 391 return builder().find(path, size); 392 } 393 /** 394 * Finds all files matching the specified file {@code name} and 395 {@code size} in or below the user's current working directory and 396 writes the file names to the standard output. Matching files use 397 at least {@code size} bytes on disk if {@code size} is positive, 398 or at most {@code abs(size)} bytes if {@code size} is zero or 399 negative. 400<p> 401 The files names written to the output are relative paths referring 402 to the working directory. 403 * <p> 404 * Note that the method returns the command builder to allow for command 405 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 406 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 407 * 408 * @param size Consider only files using at least {@code size} bytes if {@code size} 409 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 410 or negative. 411 * @param name Name pattern to match the file name after removing the path with the 412 leading directories; wildcards * and ? are supported, or full 413 regular expressions if either of the options {@code -regex (-r)} or 414 {@code -iregex (-i)} is specified. 415 * @return the command builder to allow for method chaining. Method 416 * chaining is used here to create command chains. Adding a command 417 * to the chain usually means that the previous command <i>pipes</i> 418 * its output to the added command (the pipe symbol in unix) 419 */ 420 public static Unix4jCommandBuilder find(long size, String name) { 421 return builder().find(size, name); 422 } 423 /** 424 * Finds all files matching the specified file {@code name} and 425 {@code size} in or below the directory specified by {@code path} 426 and writes the file names to the standard output. Matching files 427 use at least {@code size} bytes on disk if {@code size} is positive, 428 or at most {@code abs(size)} bytes if {@code size} is zero or 429 negative. 430<p> 431 The files names written to the output are paths relative to the 432 specified {@code path} operand. 433 * <p> 434 * Note that the method returns the command builder to allow for command 435 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 436 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 437 * 438 * @param path Starting point for the search in the directory hierarchy; 439 wildcards * and ? are supported; relative paths are resolved on the 440 basis of the current working directory. 441 * @param size Consider only files using at least {@code size} bytes if {@code size} 442 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 443 or negative. 444 * @param name Name pattern to match the file name after removing the path with the 445 leading directories; wildcards * and ? are supported, or full 446 regular expressions if either of the options {@code -regex (-r)} or 447 {@code -iregex (-i)} is specified. 448 * @return the command builder to allow for method chaining. Method 449 * chaining is used here to create command chains. Adding a command 450 * to the chain usually means that the previous command <i>pipes</i> 451 * its output to the added command (the pipe symbol in unix) 452 */ 453 public static Unix4jCommandBuilder find(String path, long size, String name) { 454 return builder().find(path, size, name); 455 } 456 /** 457 * Finds all files matching the specified {@code name} in or below the 458 user's current working directory and writes the file names to the 459 standard output. 460 <p> 461 The files names written to the output are relative paths referring 462 to the working directory. 463 * <p> 464 * Note that the method returns the command builder to allow for command 465 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 466 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 467 * 468 * @param options Options for the file search. 469 * @param name Name pattern to match the file name after removing the path with the 470 leading directories; wildcards * and ? are supported, or full 471 regular expressions if either of the options {@code -regex (-r)} or 472 {@code -iregex (-i)} is specified. 473 * @return the command builder to allow for method chaining. Method 474 * chaining is used here to create command chains. Adding a command 475 * to the chain usually means that the previous command <i>pipes</i> 476 * its output to the added command (the pipe symbol in unix) 477 */ 478 public static Unix4jCommandBuilder find(FindOptions options, String name) { 479 return builder().find(options, name); 480 } 481 /** 482 * Finds all files matching the specified {@code name} in or below the 483 directory specified by {@code path} and writes the file names to 484 the standard output. 485<p> 486 The files names written to the output are paths relative to the 487 specified {@code path} operand. 488 * <p> 489 * Note that the method returns the command builder to allow for command 490 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 491 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 492 * 493 * @param options Options for the file search. 494 * @param path Starting point for the search in the directory hierarchy; 495 wildcards * and ? are supported; relative paths are resolved on the 496 basis of the current working directory. 497 * @param name Name pattern to match the file name after removing the path with the 498 leading directories; wildcards * and ? are supported, or full 499 regular expressions if either of the options {@code -regex (-r)} or 500 {@code -iregex (-i)} is specified. 501 * @return the command builder to allow for method chaining. Method 502 * chaining is used here to create command chains. Adding a command 503 * to the chain usually means that the previous command <i>pipes</i> 504 * its output to the added command (the pipe symbol in unix) 505 */ 506 public static Unix4jCommandBuilder find(FindOptions options, String path, String name) { 507 return builder().find(options, path, name); 508 } 509 /** 510 * Finds all files matching the specified file {@code size} in or below 511 the user's current working directory and writes the file names to 512 the standard output. Matching files use at least {@code size} bytes 513 on disk if {@code size} is positive, or at most {@code abs(size)} 514 bytes if {@code size} is zero or negative. 515<p> 516 The files names written to the output are relative paths referring 517 to the working directory. 518 * <p> 519 * Note that the method returns the command builder to allow for command 520 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 521 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 522 * 523 * @param options Options for the file search. 524 * @param size Consider only files using at least {@code size} bytes if {@code size} 525 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 526 or negative. 527 * @return the command builder to allow for method chaining. Method 528 * chaining is used here to create command chains. Adding a command 529 * to the chain usually means that the previous command <i>pipes</i> 530 * its output to the added command (the pipe symbol in unix) 531 */ 532 public static Unix4jCommandBuilder find(FindOptions options, long size) { 533 return builder().find(options, size); 534 } 535 /** 536 * Finds all files matching the specified file {@code size} in or below 537 the directory specified by {@code path} and writes the file names 538 to the standard output. Matching files use at least {@code size} 539 bytes on disk if {@code size} is positive, or at most 540 {@code abs(size)} bytes if {@code size} is zero or negative. 541<p> 542 The files names written to the output are paths relative to the 543 specified {@code path} operand. 544 * <p> 545 * Note that the method returns the command builder to allow for command 546 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 547 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 548 * 549 * @param options Options for the file search. 550 * @param path Starting point for the search in the directory hierarchy; 551 wildcards * and ? are supported; relative paths are resolved on the 552 basis of the current working directory. 553 * @param size Consider only files using at least {@code size} bytes if {@code size} 554 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 555 or negative. 556 * @return the command builder to allow for method chaining. Method 557 * chaining is used here to create command chains. Adding a command 558 * to the chain usually means that the previous command <i>pipes</i> 559 * its output to the added command (the pipe symbol in unix) 560 */ 561 public static Unix4jCommandBuilder find(FindOptions options, String path, long size) { 562 return builder().find(options, path, size); 563 } 564 /** 565 * Finds all files that have been created, modified or accessed before 566 or after the specified {@code time} (depending on the given 567 {@code -time...} options). The names of the matching files found in 568 or below the user's current working directory are written to the 569 standard output. 570<p> 571 The files names written to the output are relative paths referring 572 to the working directory. 573 * <p> 574 * Note that the method returns the command builder to allow for command 575 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 576 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 577 * 578 * @param options Options for the file search. 579 * @param time Consider only files that have been created, modified or accessed 580 before or after the specified {@code time} operand; consider the 581 {@code -time...} options for details of the comparison. 582 * @return the command builder to allow for method chaining. Method 583 * chaining is used here to create command chains. Adding a command 584 * to the chain usually means that the previous command <i>pipes</i> 585 * its output to the added command (the pipe symbol in unix) 586 */ 587 public static Unix4jCommandBuilder find(FindOptions options, java.util.Date time) { 588 return builder().find(options, time); 589 } 590 /** 591 * Finds all files that have been created, modified or accessed before 592 or after the specified {@code time} (depending on the given 593 {@code -time...} options). The names of the matching files found in 594 or below the directory specified by {@code path} are written to 595 the standard output. 596<p> 597 The files names written to the output are paths relative to the 598 specified {@code path} operand. 599 * <p> 600 * Note that the method returns the command builder to allow for command 601 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 602 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 603 * 604 * @param options Options for the file search. 605 * @param path Starting point for the search in the directory hierarchy; 606 wildcards * and ? are supported; relative paths are resolved on the 607 basis of the current working directory. 608 * @param time Consider only files that have been created, modified or accessed 609 before or after the specified {@code time} operand; consider the 610 {@code -time...} options for details of the comparison. 611 * @return the command builder to allow for method chaining. Method 612 * chaining is used here to create command chains. Adding a command 613 * to the chain usually means that the previous command <i>pipes</i> 614 * its output to the added command (the pipe symbol in unix) 615 */ 616 public static Unix4jCommandBuilder find(FindOptions options, String path, java.util.Date time) { 617 return builder().find(options, path, time); 618 } 619 /** 620 * Finds all files matching the specified file {@code name} and 621 {@code size} in or below the user's current working directory and 622 writes the file names to the standard output. Matching files use 623 at least {@code size} bytes on disk if {@code size} is positive, or 624 at most {@code abs(size)} bytes if {@code size} is zero or negative. 625<p> 626 The files names written to the output are relative paths referring 627 to the working directory. 628 * <p> 629 * Note that the method returns the command builder to allow for command 630 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 631 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 632 * 633 * @param options Options for the file search. 634 * @param size Consider only files using at least {@code size} bytes if {@code size} 635 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 636 or negative. 637 * @param name Name pattern to match the file name after removing the path with the 638 leading directories; wildcards * and ? are supported, or full 639 regular expressions if either of the options {@code -regex (-r)} or 640 {@code -iregex (-i)} is specified. 641 * @return the command builder to allow for method chaining. Method 642 * chaining is used here to create command chains. Adding a command 643 * to the chain usually means that the previous command <i>pipes</i> 644 * its output to the added command (the pipe symbol in unix) 645 */ 646 public static Unix4jCommandBuilder find(FindOptions options, long size, String name) { 647 return builder().find(options, size, name); 648 } 649 /** 650 * Finds all files matching the specified file {@code name} and 651 {@code size} in or below the directory specified by {@code path} 652 and writes the file names to the standard output. Matching files 653 use at least {@code size} bytes on disk if {@code size} is positive, 654 or at most {@code abs(size)} bytes if {@code size} is zero or 655 negative. 656<p> 657 The files names written to the output are paths relative to the 658 specified {@code path} operand. 659 * <p> 660 * Note that the method returns the command builder to allow for command 661 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 662 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 663 * 664 * @param options Options for the file search. 665 * @param path Starting point for the search in the directory hierarchy; 666 wildcards * and ? are supported; relative paths are resolved on the 667 basis of the current working directory. 668 * @param size Consider only files using at least {@code size} bytes if {@code size} 669 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 670 or negative. 671 * @param name Name pattern to match the file name after removing the path with the 672 leading directories; wildcards * and ? are supported, or full 673 regular expressions if either of the options {@code -regex (-r)} or 674 {@code -iregex (-i)} is specified. 675 * @return the command builder to allow for method chaining. Method 676 * chaining is used here to create command chains. Adding a command 677 * to the chain usually means that the previous command <i>pipes</i> 678 * its output to the added command (the pipe symbol in unix) 679 */ 680 public static Unix4jCommandBuilder find(FindOptions options, String path, long size, String name) { 681 return builder().find(options, path, size, name); 682 } 683 /** 684 * Finds all files matching the given {@code name} that have been 685 created, modified or accessed before or after the specified 686 {@code time} (depending on the given {@code -time...} options). The 687 names of the matching files found in or below the user's current 688 working directory are written to the standard output. 689<p> 690 The files names written to the output are relative paths referring 691 to the working directory. 692 * <p> 693 * Note that the method returns the command builder to allow for command 694 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 695 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 696 * 697 * @param options Options for the file search. 698 * @param time Consider only files that have been created, modified or accessed 699 before or after the specified {@code time} operand; consider the 700 {@code -time...} options for details of the comparison. 701 * @param name Name pattern to match the file name after removing the path with the 702 leading directories; wildcards * and ? are supported, or full 703 regular expressions if either of the options {@code -regex (-r)} or 704 {@code -iregex (-i)} is specified. 705 * @return the command builder to allow for method chaining. Method 706 * chaining is used here to create command chains. Adding a command 707 * to the chain usually means that the previous command <i>pipes</i> 708 * its output to the added command (the pipe symbol in unix) 709 */ 710 public static Unix4jCommandBuilder find(FindOptions options, java.util.Date time, String name) { 711 return builder().find(options, time, name); 712 } 713 /** 714 * Finds all files matching the given {@code name} that have been 715 created, modified or accessed before or after the specified 716 {@code time} (depending on the given {@code -time...} options). The 717 names of the matching files found in or below the directory 718 specified by {@code path} are written to the standard output. 719<p> 720 The files names written to the output are paths relative to the 721 specified {@code path} operand. 722 * <p> 723 * Note that the method returns the command builder to allow for command 724 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 725 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 726 * 727 * @param options Options for the file search. 728 * @param path Starting point for the search in the directory hierarchy; 729 wildcards * and ? are supported; relative paths are resolved on the 730 basis of the current working directory. 731 * @param time Consider only files that have been created, modified or accessed 732 before or after the specified {@code time} operand; consider the 733 {@code -time...} options for details of the comparison. 734 * @param name Name pattern to match the file name after removing the path with the 735 leading directories; wildcards * and ? are supported, or full 736 regular expressions if either of the options {@code -regex (-r)} or 737 {@code -iregex (-i)} is specified. 738 * @return the command builder to allow for method chaining. Method 739 * chaining is used here to create command chains. Adding a command 740 * to the chain usually means that the previous command <i>pipes</i> 741 * its output to the added command (the pipe symbol in unix) 742 */ 743 public static Unix4jCommandBuilder find(FindOptions options, String path, java.util.Date time, String name) { 744 return builder().find(options, path, time, name); 745 } 746 /** 747 * Finds all files matching the given {@code name} and {@code size} and 748 have been created, modified or accessed before or after the specified 749 {@code time} (depending on the given {@code -time...} options). 750 <p> 751 Matching files use at least {@code size} bytes on disk if 752 {@code size} is positive, or at most {@code abs(size)} bytes if 753 {@code size} is zero or negative. The names of the matching files 754 found in or below the user's current working directory are written 755 to the standard output. 756<p> 757 The files names written to the output are relative paths referring 758 to the working directory. 759 * <p> 760 * Note that the method returns the command builder to allow for command 761 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 762 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 763 * 764 * @param options Options for the file search. 765 * @param size Consider only files using at least {@code size} bytes if {@code size} 766 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 767 or negative. 768 * @param time Consider only files that have been created, modified or accessed 769 before or after the specified {@code time} operand; consider the 770 {@code -time...} options for details of the comparison. 771 * @param name Name pattern to match the file name after removing the path with the 772 leading directories; wildcards * and ? are supported, or full 773 regular expressions if either of the options {@code -regex (-r)} or 774 {@code -iregex (-i)} is specified. 775 * @return the command builder to allow for method chaining. Method 776 * chaining is used here to create command chains. Adding a command 777 * to the chain usually means that the previous command <i>pipes</i> 778 * its output to the added command (the pipe symbol in unix) 779 */ 780 public static Unix4jCommandBuilder find(FindOptions options, long size, java.util.Date time, String name) { 781 return builder().find(options, size, time, name); 782 } 783 /** 784 * Finds all files matching the given {@code name} and {@code size} and 785 have been created, modified or accessed before or after the specified 786 {@code time} (depending on the given {@code -time...} options). 787 <p> 788 Matching files use at least {@code size} bytes on disk if 789 {@code size} is positive, or at most {@code abs(size)} bytes if 790 {@code size} is zero or negative. The names of the matching files 791 found in or below the directory specified by {@code path} are 792 written to the standard output. 793<p> 794 The files names written to the output are paths relative to the 795 specified {@code path} operand. 796 * <p> 797 * Note that the method returns the command builder to allow for command 798 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 799 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 800 * 801 * @param options Options for the file search. 802 * @param path Starting point for the search in the directory hierarchy; 803 wildcards * and ? are supported; relative paths are resolved on the 804 basis of the current working directory. 805 * @param size Consider only files using at least {@code size} bytes if {@code size} 806 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 807 or negative. 808 * @param time Consider only files that have been created, modified or accessed 809 before or after the specified {@code time} operand; consider the 810 {@code -time...} options for details of the comparison. 811 * @param name Name pattern to match the file name after removing the path with the 812 leading directories; wildcards * and ? are supported, or full 813 regular expressions if either of the options {@code -regex (-r)} or 814 {@code -iregex (-i)} is specified. 815 * @return the command builder to allow for method chaining. Method 816 * chaining is used here to create command chains. Adding a command 817 * to the chain usually means that the previous command <i>pipes</i> 818 * its output to the added command (the pipe symbol in unix) 819 */ 820 public static Unix4jCommandBuilder find(FindOptions options, String path, long size, java.util.Date time, String name) { 821 return builder().find(options, path, size, time, name); 822 } 823 /** 824 * Uses the given string as input for the next command. If the string 825 contains line ending codes (UNIX or DOS independent from the host 826 operating system), the string is split into multiple lines. 827 * <p> 828 * Note that the method returns the command builder to allow for command 829 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 830 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 831 * 832 * @param string the string to use as input 833 * @return the command builder to allow for method chaining. Method 834 * chaining is used here to create command chains. Adding a command 835 * to the chain usually means that the previous command <i>pipes</i> 836 * its output to the added command (the pipe symbol in unix) 837 */ 838 public static Unix4jCommandBuilder fromString(String string) { 839 return builder().fromString(string); 840 } 841 /** 842 * Uses the given strings as input for the next command. Each string 843 usually represents a single line of the input; however, if any of 844 the strings contains line ending codes (UNIX or DOS independent from 845 the host operating system), it is split into multiple lines. 846 * <p> 847 * Note that the method returns the command builder to allow for command 848 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 849 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 850 * 851 * @param strings the input lines 852 * @return the command builder to allow for method chaining. Method 853 * chaining is used here to create command chains. Adding a command 854 * to the chain usually means that the previous command <i>pipes</i> 855 * its output to the added command (the pipe symbol in unix) 856 */ 857 public static Unix4jCommandBuilder fromStrings(String... strings) { 858 return builder().fromStrings(strings); 859 } 860 /** 861 * Uses the strings in the specified {@code input} collection as input 862 lines for the next command. Each string usually represents a single 863 line of the input; however, if any of the strings contains line 864 ending codes (UNIX or DOS independent from the host operating 865 system), it is split into multiple lines. 866 * <p> 867 * Note that the method returns the command builder to allow for command 868 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 869 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 870 * 871 * @param lines collection with input lines 872 * @return the command builder to allow for method chaining. Method 873 * chaining is used here to create command chains. Adding a command 874 * to the chain usually means that the previous command <i>pipes</i> 875 * its output to the added command (the pipe symbol in unix) 876 */ 877 public static Unix4jCommandBuilder from(java.util.Collection<? extends String> lines) { 878 return builder().from(lines); 879 } 880 /** 881 * Redirects the contents of the given file into the next command. This 882 is essentially equivalent to the following syntax in a unix command 883 shell: {@code path > ...} 884 * <p> 885 * Note that the method returns the command builder to allow for command 886 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 887 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 888 * 889 * @param path the file to use as input; wildcards * and ? are supported; relative 890 paths are resolved on the basis of the current working directory. 891 * @return the command builder to allow for method chaining. Method 892 * chaining is used here to create command chains. Adding a command 893 * to the chain usually means that the previous command <i>pipes</i> 894 * its output to the added command (the pipe symbol in unix) 895 */ 896 public static Unix4jCommandBuilder fromFile(String path) { 897 return builder().fromFile(path); 898 } 899 /** 900 * Redirects the contents of the given file into the next command. This 901 is essentially equivalent to the following syntax in a unix command 902 shell: {@code file > ...} 903 * <p> 904 * Note that the method returns the command builder to allow for command 905 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 906 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 907 * 908 * @param file the file to use as input; relative paths are not resolved (use the 909 string path argument to enable relative path resolving based on the 910 current working directory). 911 * @return the command builder to allow for method chaining. Method 912 * chaining is used here to create command chains. Adding a command 913 * to the chain usually means that the previous command <i>pipes</i> 914 * its output to the added command (the pipe symbol in unix) 915 */ 916 public static Unix4jCommandBuilder fromFile(java.io.File file) { 917 return builder().fromFile(file); 918 } 919 /** 920 * Reads from the given resource relative to the classpath and 921 redirects the contents into the next command. The resource is 922 usually a file or URL on the classpath. The resource is read using 923 {@link Class#getResourceAsStream(String)}. 924 * <p> 925 * Note that the method returns the command builder to allow for command 926 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 927 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 928 * 929 * @param resource a path to the file to redirect to the next command. The will need 930 to be on the classpath. If the file is in the root directory, the 931 filename should be prefixed with a forward slash. e.g.: 932 {@code "/test-file.txt"} 933 <p> 934 If the file is in a package, then the package should be specified 935 prefixed with a forward slash, and with each dot "." replaced with a 936 forward slash. e.g.: 937 {@code "/org/company/mypackage/test-file.txt"} 938 * @return the command builder to allow for method chaining. Method 939 * chaining is used here to create command chains. Adding a command 940 * to the chain usually means that the previous command <i>pipes</i> 941 * its output to the added command (the pipe symbol in unix) 942 */ 943 public static Unix4jCommandBuilder fromResource(String resource) { 944 return builder().fromResource(resource); 945 } 946 /** 947 * Reads from the given input stream and redirects the contents into 948 the next command. 949 * <p> 950 * Note that the method returns the command builder to allow for command 951 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 952 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 953 * 954 * @param stream the input stream to read from 955 * @return the command builder to allow for method chaining. Method 956 * chaining is used here to create command chains. Adding a command 957 * to the chain usually means that the previous command <i>pipes</i> 958 * its output to the added command (the pipe symbol in unix) 959 */ 960 public static Unix4jCommandBuilder from(java.io.InputStream stream) { 961 return builder().from(stream); 962 } 963 /** 964 * Uses the given reader and redirects the read input into the next 965 command. 966 * <p> 967 * Note that the method returns the command builder to allow for command 968 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 969 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 970 * 971 * @param reader the reader used to read the input 972 * @return the command builder to allow for method chaining. Method 973 * chaining is used here to create command chains. Adding a command 974 * to the chain usually means that the previous command <i>pipes</i> 975 * its output to the added command (the pipe symbol in unix) 976 */ 977 public static Unix4jCommandBuilder from(java.io.Reader reader) { 978 return builder().from(reader); 979 } 980 /** 981 * Reads from the given URL and redirects the contents into the next 982 command. 983 * <p> 984 * Note that the method returns the command builder to allow for command 985 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 986 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 987 * 988 * @param url the URL to read from 989 * @return the command builder to allow for method chaining. Method 990 * chaining is used here to create command chains. Adding a command 991 * to the chain usually means that the previous command <i>pipes</i> 992 * its output to the added command (the pipe symbol in unix) 993 */ 994 public static Unix4jCommandBuilder from(java.net.URL url) { 995 return builder().from(url); 996 } 997 /** 998 * Reads from the given input object and redirects the contents into 999 the next command. 1000 * <p> 1001 * Note that the method returns the command builder to allow for command 1002 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1003 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1004 * 1005 * @param input the input object to read from 1006 * @return the command builder to allow for method chaining. Method 1007 * chaining is used here to create command chains. Adding a command 1008 * to the chain usually means that the previous command <i>pipes</i> 1009 * its output to the added command (the pipe symbol in unix) 1010 */ 1011 public static Unix4jCommandBuilder from(org.unix4j.io.Input input) { 1012 return builder().from(input); 1013 } 1014 /** 1015 * Filters the lines from the specified input files and writes the 1016 matching lines to the standard output. Every line is matched against 1017 the given {@code regexp} string using case-sensitive comparison. 1018 Line endings are not relevant for the comparison. 1019 * <p> 1020 * Note that the method returns the command builder to allow for command 1021 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1022 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1023 * 1024 * @param regexp Lines will be printed which match the given regular expression. The 1025 {@code regexp} string is surrounded with ".*" on both sides unless 1026 the {@code --wholeLine} option is specified. If the 1027 {@code --fixedStrings} option is used, plain string comparison is 1028 used instead of regular expression matching. 1029 * @param files The input files to be searched for the pattern; relative paths are 1030 not resolved (use the string paths argument to enable relative path 1031 resolving based on the current working directory). 1032 * @return the command builder to allow for method chaining. Method 1033 * chaining is used here to create command chains. Adding a command 1034 * to the chain usually means that the previous command <i>pipes</i> 1035 * its output to the added command (the pipe symbol in unix) 1036 */ 1037 public static Unix4jCommandBuilder grep(String regexp, java.io.File... files) { 1038 return builder().grep(regexp, files); 1039 } 1040 /** 1041 * Filters the lines from the specified input files and writes the 1042 matching lines to the standard output. Every line is matched against 1043 the given regular expression {@code pattern} using case-sensitive 1044 comparison. Line endings are not relevant for the comparison. 1045 * <p> 1046 * Note that the method returns the command builder to allow for command 1047 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1048 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1049 * 1050 * @param pattern Lines will be printed which match the given pattern. 1051 * @param files The input files to be searched for the pattern; relative paths are 1052 not resolved (use the string paths argument to enable relative path 1053 resolving based on the current working directory). 1054 * @return the command builder to allow for method chaining. Method 1055 * chaining is used here to create command chains. Adding a command 1056 * to the chain usually means that the previous command <i>pipes</i> 1057 * its output to the added command (the pipe symbol in unix) 1058 */ 1059 public static Unix4jCommandBuilder grep(java.util.regex.Pattern pattern, java.io.File... files) { 1060 return builder().grep(pattern, files); 1061 } 1062 /** 1063 * Filters the lines from the specified input files and writes the 1064 matching lines to the standard output. Every line is matched against 1065 the given regular expression {@code pattern} using case-sensitive 1066 comparison. Line endings are not relevant for the comparison. 1067 * <p> 1068 * Note that the method returns the command builder to allow for command 1069 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1070 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1071 * 1072 * @param pattern Lines will be printed which match the given pattern. 1073 * @param paths Pathnames of the input files to be searched for the pattern; 1074 wildcards * and ? are supported; relative paths are resolved on the 1075 basis of the current working directory. 1076 * @return the command builder to allow for method chaining. Method 1077 * chaining is used here to create command chains. Adding a command 1078 * to the chain usually means that the previous command <i>pipes</i> 1079 * its output to the added command (the pipe symbol in unix) 1080 */ 1081 public static Unix4jCommandBuilder grep(java.util.regex.Pattern pattern, String... paths) { 1082 return builder().grep(pattern, paths); 1083 } 1084 /** 1085 * Filters the input lines from the specified input files and writes 1086 the matching lines to the standard output. Every line is matched 1087 against the given {@code regexp} string; the exact comparison rules 1088 are defined by the specified matching {@code options}. 1089 * <p> 1090 * Note that the method returns the command builder to allow for command 1091 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1092 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1093 * 1094 * @param options The options defining the types of patterns and command behavior. 1095 * @param regexp Lines will be printed which match the given regular expression. The 1096 {@code regexp} string is surrounded with ".*" on both sides unless 1097 the {@code --wholeLine} option is specified. If the 1098 {@code --fixedStrings} option is used, plain string comparison is 1099 used instead of regular expression matching. 1100 * @param files The input files to be searched for the pattern; relative paths are 1101 not resolved (use the string paths argument to enable relative path 1102 resolving based on the current working directory). 1103 * @return the command builder to allow for method chaining. Method 1104 * chaining is used here to create command chains. Adding a command 1105 * to the chain usually means that the previous command <i>pipes</i> 1106 * its output to the added command (the pipe symbol in unix) 1107 */ 1108 public static Unix4jCommandBuilder grep(GrepOptions options, String regexp, java.io.File... files) { 1109 return builder().grep(options, regexp, files); 1110 } 1111 /** 1112 * Filters the input lines from the specified input files and writes 1113 the matching lines to the standard output. Every line is matched 1114 against the given {@code regexp} string; the exact comparison rules 1115 are defined by the specified matching {@code options}. 1116 * <p> 1117 * Note that the method returns the command builder to allow for command 1118 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1119 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1120 * 1121 * @param options The options defining the types of patterns and command behavior. 1122 * @param regexp Lines will be printed which match the given regular expression. The 1123 {@code regexp} string is surrounded with ".*" on both sides unless 1124 the {@code --wholeLine} option is specified. If the 1125 {@code --fixedStrings} option is used, plain string comparison is 1126 used instead of regular expression matching. 1127 * @param paths Pathnames of the input files to be searched for the pattern; 1128 wildcards * and ? are supported; relative paths are resolved on the 1129 basis of the current working directory. 1130 * @return the command builder to allow for method chaining. Method 1131 * chaining is used here to create command chains. Adding a command 1132 * to the chain usually means that the previous command <i>pipes</i> 1133 * its output to the added command (the pipe symbol in unix) 1134 */ 1135 public static Unix4jCommandBuilder grep(GrepOptions options, String regexp, String... paths) { 1136 return builder().grep(options, regexp, paths); 1137 } 1138 /** 1139 * Filters the input lines from the specified input files and writes 1140 the matching lines to the standard output. Every line is matched 1141 against the given regular expression {@code pattern}; the exact 1142 comparison rules are defined by the specified matching 1143 {@code options}. 1144 * <p> 1145 * Note that the method returns the command builder to allow for command 1146 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1147 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1148 * 1149 * @param options The options defining the types of patterns and command behavior. 1150 * @param pattern Lines will be printed which match the given pattern. 1151 * @param files The input files to be searched for the pattern; relative paths are 1152 not resolved (use the string paths argument to enable relative path 1153 resolving based on the current working directory). 1154 * @return the command builder to allow for method chaining. Method 1155 * chaining is used here to create command chains. Adding a command 1156 * to the chain usually means that the previous command <i>pipes</i> 1157 * its output to the added command (the pipe symbol in unix) 1158 */ 1159 public static Unix4jCommandBuilder grep(GrepOptions options, java.util.regex.Pattern pattern, java.io.File... files) { 1160 return builder().grep(options, pattern, files); 1161 } 1162 /** 1163 * Filters the input lines from the specified input files and writes 1164 the matching lines to the standard output. Every line is matched 1165 against the given regular expression {@code pattern}; the exact 1166 comparison rules are defined by the specified matching 1167 {@code options}. 1168 * <p> 1169 * Note that the method returns the command builder to allow for command 1170 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1171 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1172 * 1173 * @param options The options defining the types of patterns and command behavior. 1174 * @param pattern Lines will be printed which match the given pattern. 1175 * @param paths Pathnames of the input files to be searched for the pattern; 1176 wildcards * and ? are supported; relative paths are resolved on the 1177 basis of the current working directory. 1178 * @return the command builder to allow for method chaining. Method 1179 * chaining is used here to create command chains. Adding a command 1180 * to the chain usually means that the previous command <i>pipes</i> 1181 * its output to the added command (the pipe symbol in unix) 1182 */ 1183 public static Unix4jCommandBuilder grep(GrepOptions options, java.util.regex.Pattern pattern, String... paths) { 1184 return builder().grep(options, pattern, paths); 1185 } 1186 /** 1187 * Reads the first 10 lines from each of the specified files and writes 1188 them to the standard output. If more than a single file is 1189 specified, each file is preceded by a header consisting of the 1190 string {@code "==> XXX <=="} where {@code "XXX"} is the name 1191 of the file. 1192 * <p> 1193 * Note that the method returns the command builder to allow for command 1194 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1195 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1196 * 1197 * @param files The input files to be filtered; relative paths are not resolved (use 1198 the string paths argument to enable relative path resolving based on 1199 the current working directory). 1200 * @return the command builder to allow for method chaining. Method 1201 * chaining is used here to create command chains. Adding a command 1202 * to the chain usually means that the previous command <i>pipes</i> 1203 * its output to the added command (the pipe symbol in unix) 1204 */ 1205 public static Unix4jCommandBuilder head(java.io.File... files) { 1206 return builder().head(files); 1207 } 1208 /** 1209 * Reads the first {@code count} lines from each of the specified files 1210 and writes them to the standard output. If more than a single file 1211 is specified, each file is preceded by a header consisting of the 1212 string {@code "==> XXX <=="} where {@code "XXX"} is the name 1213 of the file. 1214 * <p> 1215 * Note that the method returns the command builder to allow for command 1216 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1217 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1218 * 1219 * @param count The first {@code count} lines of each input file are 1220 copied to standard output, starting from 1 (characters instead of 1221 lines if the {@code -c} option is specified). Must be a non-negative 1222 integer or an exception is thrown. If {@code count} is greater than 1223 the number number of lines (characters) in the input, the 1224 application will not error and send the whole file to the output. 1225 * @param files The input files to be filtered; relative paths are not resolved (use 1226 the string paths argument to enable relative path resolving based on 1227 the current working directory). 1228 * @return the command builder to allow for method chaining. Method 1229 * chaining is used here to create command chains. Adding a command 1230 * to the chain usually means that the previous command <i>pipes</i> 1231 * its output to the added command (the pipe symbol in unix) 1232 */ 1233 public static Unix4jCommandBuilder head(long count, java.io.File... files) { 1234 return builder().head(count, files); 1235 } 1236 /** 1237 * Reads the first {@code count} lines from each of the specified files 1238 and writes them to the standard output. If more than a single file 1239 is specified, each file is preceded by a header consisting of the 1240 string {@code "==> XXX <=="} where {@code "XXX"} is the name 1241 of the file. 1242 * <p> 1243 * Note that the method returns the command builder to allow for command 1244 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1245 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1246 * 1247 * @param count The first {@code count} lines of each input file are 1248 copied to standard output, starting from 1 (characters instead of 1249 lines if the {@code -c} option is specified). Must be a non-negative 1250 integer or an exception is thrown. If {@code count} is greater than 1251 the number number of lines (characters) in the input, the 1252 application will not error and send the whole file to the output. 1253 * @param paths Pathnames of the input files to be filtered; wildcards * and ? are 1254 supported; relative paths are resolved on the basis of the current 1255 working directory. 1256 * @return the command builder to allow for method chaining. Method 1257 * chaining is used here to create command chains. Adding a command 1258 * to the chain usually means that the previous command <i>pipes</i> 1259 * its output to the added command (the pipe symbol in unix) 1260 */ 1261 public static Unix4jCommandBuilder head(long count, String... paths) { 1262 return builder().head(count, paths); 1263 } 1264 /** 1265 * Reads the first {@code count} lines or characters from each of the 1266 specified files and writes them to the standard output. If more than 1267 a single file is specified and the {@code -q} option is not 1268 specified, each file is preceded by a header consisting of the 1269 string {@code "==> XXX <=="} where {@code "XXX"} is the name 1270 of the file. 1271 * <p> 1272 * Note that the method returns the command builder to allow for command 1273 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1274 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1275 * 1276 * @param options Options for the head command. 1277 * @param count The first {@code count} lines of each input file are 1278 copied to standard output, starting from 1 (characters instead of 1279 lines if the {@code -c} option is specified). Must be a non-negative 1280 integer or an exception is thrown. If {@code count} is greater than 1281 the number number of lines (characters) in the input, the 1282 application will not error and send the whole file to the output. 1283 * @param files The input files to be filtered; relative paths are not resolved (use 1284 the string paths argument to enable relative path resolving based on 1285 the current working directory). 1286 * @return the command builder to allow for method chaining. Method 1287 * chaining is used here to create command chains. Adding a command 1288 * to the chain usually means that the previous command <i>pipes</i> 1289 * its output to the added command (the pipe symbol in unix) 1290 */ 1291 public static Unix4jCommandBuilder head(HeadOptions options, long count, java.io.File... files) { 1292 return builder().head(options, count, files); 1293 } 1294 /** 1295 * Reads the first {@code count} lines or characters from each of the 1296 specified files and writes them to the standard output. If more than 1297 a single file is specified and the {@code -q} option is not 1298 specified, each file is preceded by a header consisting of the 1299 string {@code "==> XXX <=="} where {@code "XXX"} is the name 1300 of the file. 1301 * <p> 1302 * Note that the method returns the command builder to allow for command 1303 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1304 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1305 * 1306 * @param options Options for the head command. 1307 * @param count The first {@code count} lines of each input file are 1308 copied to standard output, starting from 1 (characters instead of 1309 lines if the {@code -c} option is specified). Must be a non-negative 1310 integer or an exception is thrown. If {@code count} is greater than 1311 the number number of lines (characters) in the input, the 1312 application will not error and send the whole file to the output. 1313 * @param paths Pathnames of the input files to be filtered; wildcards * and ? are 1314 supported; relative paths are resolved on the basis of the current 1315 working directory. 1316 * @return the command builder to allow for method chaining. Method 1317 * chaining is used here to create command chains. Adding a command 1318 * to the chain usually means that the previous command <i>pipes</i> 1319 * its output to the added command (the pipe symbol in unix) 1320 */ 1321 public static Unix4jCommandBuilder head(HeadOptions options, long count, String... paths) { 1322 return builder().head(options, count, paths); 1323 } 1324 /** 1325 * Lists all files and directories in the user's current working 1326 directory and writes them to the output. 1327 * <p> 1328 * Note that the method returns the command builder to allow for command 1329 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1330 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1331 * 1332 * @return the command builder to allow for method chaining. Method 1333 * chaining is used here to create command chains. Adding a command 1334 * to the chain usually means that the previous command <i>pipes</i> 1335 * its output to the added command (the pipe symbol in unix) 1336 */ 1337 public static Unix4jCommandBuilder ls() { 1338 return builder().ls(); 1339 } 1340 /** 1341 * Prints the name of the specified files and lists all files contained 1342 in directories for every directory in those files. 1343 <p> 1344 Options can be specified by acronym (with a leading dash "-") or by 1345 long name (with two leading dashes "--"). Operands other than the 1346 default "--paths" operand have to be prefixed with the operand 1347 name. 1348 * <p> 1349 * Note that the method returns the command builder to allow for command 1350 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1351 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1352 * 1353 * @param args String arguments defining the options and operands for the command. 1354 Options can be specified by acronym (with a leading dash "-") or by 1355 long name (with two leading dashes "--"). Operands other than the 1356 default "--paths" operand have to be prefixed with the operand 1357 name (e.g. "--count" for a subsequent count operand value). 1358 * @return the command builder to allow for method chaining. Method 1359 * chaining is used here to create command chains. Adding a command 1360 * to the chain usually means that the previous command <i>pipes</i> 1361 * its output to the added command (the pipe symbol in unix) 1362 */ 1363 public static Unix4jCommandBuilder ls(String... args) { 1364 return builder().ls(args); 1365 } 1366 /** 1367 * Prints the name of the given files and lists all files contained in 1368 directories for every directory in {@code files}. 1369 * <p> 1370 * Note that the method returns the command builder to allow for command 1371 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1372 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1373 * 1374 * @param files The files or directories used as starting point for the listing; 1375 relative paths are not resolved (use the string path argument to 1376 enable relative path resolving based on the current working 1377 directory). 1378 * @return the command builder to allow for method chaining. Method 1379 * chaining is used here to create command chains. Adding a command 1380 * to the chain usually means that the previous command <i>pipes</i> 1381 * its output to the added command (the pipe symbol in unix) 1382 */ 1383 public static Unix4jCommandBuilder ls(java.io.File... files) { 1384 return builder().ls(files); 1385 } 1386 /** 1387 * Lists all files and directories in the user's current working 1388 directory and writes them to the output using the given options 1389 specifying the details of the output format. 1390 * <p> 1391 * Note that the method returns the command builder to allow for command 1392 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1393 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1394 * 1395 * @param options The options defining the output format. 1396 * @return the command builder to allow for method chaining. Method 1397 * chaining is used here to create command chains. Adding a command 1398 * to the chain usually means that the previous command <i>pipes</i> 1399 * its output to the added command (the pipe symbol in unix) 1400 */ 1401 public static Unix4jCommandBuilder ls(LsOptions options) { 1402 return builder().ls(options); 1403 } 1404 /** 1405 * Prints the name of the given files and lists all files contained in 1406 directories for every directory in {@code files}. The given options 1407 define the details of the output format. 1408 * <p> 1409 * Note that the method returns the command builder to allow for command 1410 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1411 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1412 * 1413 * @param options The options defining the output format. 1414 * @param files The files or directories used as starting point for the listing; 1415 relative paths are not resolved (use the string path argument to 1416 enable relative path resolving based on the current working 1417 directory). 1418 * @return the command builder to allow for method chaining. Method 1419 * chaining is used here to create command chains. Adding a command 1420 * to the chain usually means that the previous command <i>pipes</i> 1421 * its output to the added command (the pipe symbol in unix) 1422 */ 1423 public static Unix4jCommandBuilder ls(LsOptions options, java.io.File... files) { 1424 return builder().ls(options, files); 1425 } 1426 /** 1427 * Prints the name of the given files and lists all files contained in 1428 directories for every directory in {@code files}. The given options 1429 define the details of the output format. 1430 * <p> 1431 * Note that the method returns the command builder to allow for command 1432 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1433 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1434 * 1435 * @param options The options defining the output format. 1436 * @param paths The files or directories used as starting point for the listing; 1437 wildcards * and ? are supported; relative paths are resolved on the 1438 basis of the current working directory. 1439 * @return the command builder to allow for method chaining. Method 1440 * chaining is used here to create command chains. Adding a command 1441 * to the chain usually means that the previous command <i>pipes</i> 1442 * its output to the added command (the pipe symbol in unix) 1443 */ 1444 public static Unix4jCommandBuilder ls(LsOptions options, String... paths) { 1445 return builder().ls(options, paths); 1446 } 1447 /** 1448 * Executes the sed script specified by the given arguments and writes 1449 the result to the standard output. 1450 <p> 1451 Options can be specified by acronym (with a leading dash "-") or by 1452 long name (with two leading dashes "--"). Operands other than the 1453 default "--script" operand have to be prefixed with the operand name. 1454 * <p> 1455 * Note that the method returns the command builder to allow for command 1456 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1457 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1458 * 1459 * @param args String arguments defining the options and operands for the command. 1460 Options can be specified by acronym (with a leading dash "-") or by 1461 long name (with two leading dashes "--"). Operands other than the 1462 default "--script" operand have to be prefixed with the operand name 1463 (e.g. "--occurrence" for subsequent occurrence indices). 1464 * @return the command builder to allow for method chaining. Method 1465 * chaining is used here to create command chains. Adding a command 1466 * to the chain usually means that the previous command <i>pipes</i> 1467 * its output to the added command (the pipe symbol in unix) 1468 */ 1469 public static Unix4jCommandBuilder sed(String... args) { 1470 return builder().sed(args); 1471 } 1472 /** 1473 * Executes the given sed script, such as "s/original/replacement/g". 1474 * <p> 1475 * Note that the method returns the command builder to allow for command 1476 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1477 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1478 * 1479 * @param script Sed script as one string, such as "s/original/replacement/g". 1480 * @return the command builder to allow for method chaining. Method 1481 * chaining is used here to create command chains. Adding a command 1482 * to the chain usually means that the previous command <i>pipes</i> 1483 * its output to the added command (the pipe symbol in unix) 1484 */ 1485 public static Unix4jCommandBuilder sed(String script) { 1486 return builder().sed(script); 1487 } 1488 /** 1489 * Substitutes the replacement string for instances of the regexp in 1490 the matched line. 1491 <p> 1492 The characters "$0" appearing in the replacement are replaced 1493 by the line matching the regexp. The characters "$n", where n is a 1494 digit other than zero, are replaced by the text matched by the 1495 corresponding backreference expression (aka group). The special 1496 meaning of "$n" in this context can be suppressed by preceding it 1497 by a backslash. 1498<p> 1499 A line can be split by substituting a newline ('\n') into it. 1500 <p> 1501 A substitution is considered to have been performed even if the 1502 replacement string is identical to the string that it replaces. 1503 * <p> 1504 * Note that the method returns the command builder to allow for command 1505 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1506 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1507 * 1508 * @param regexp Regular expression matched against a line. 1509 * @param replacement Replacement string for substitute command. The characters "$0" 1510 appearing in the replacement are replaced by the line matching 1511 the regexp. The characters "$n", where n is a digit other than zero, 1512 are replaced by the text matched by the corresponding backreference 1513 expression (aka group). The special meaning of "$n" in this context 1514 can be suppressed by preceding it by a backslash. 1515 * @return the command builder to allow for method chaining. Method 1516 * chaining is used here to create command chains. Adding a command 1517 * to the chain usually means that the previous command <i>pipes</i> 1518 * its output to the added command (the pipe symbol in unix) 1519 */ 1520 public static Unix4jCommandBuilder sed(String regexp, String replacement) { 1521 return builder().sed(regexp, replacement); 1522 } 1523 /** 1524 * Substitutes the replacement string for instances of the regexp in 1525 the matched line. Only the given occurrences of the regexp found 1526 within the matched string are substituted. 1527<p> 1528 The characters "$0" appearing in the replacement are replaced 1529 by the line matching the regexp. The characters "$n", where n is a 1530 digit other than zero, are replaced by the text matched by the 1531 corresponding backreference expression (aka group). The special 1532 meaning of "$n" in this context can be suppressed by preceding it 1533 by a backslash. 1534<p> 1535 A line can be split by substituting a newline ('\n') into it. 1536 <p> 1537 A substitution is considered to have been performed even if the 1538 replacement string is identical to the string that it replaces. 1539 * <p> 1540 * Note that the method returns the command builder to allow for command 1541 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1542 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1543 * 1544 * @param regexp Regular expression matched against a line. 1545 * @param replacement Replacement string for substitute command. The characters "$0" 1546 appearing in the replacement are replaced by the line matching 1547 the regexp. The characters "$n", where n is a digit other than zero, 1548 are replaced by the text matched by the corresponding backreference 1549 expression (aka group). The special meaning of "$n" in this context 1550 can be suppressed by preceding it by a backslash. 1551 * @param occurrence Substitute for the given occurrences only of the regexp found within 1552 the matched string; the occurrence indices are one-based. If empty 1553 or omitted, all occurrences are substituted. 1554 <p> 1555 (This operand only applies to the substitute command and is ignored 1556 by all other commands). 1557 * @return the command builder to allow for method chaining. Method 1558 * chaining is used here to create command chains. Adding a command 1559 * to the chain usually means that the previous command <i>pipes</i> 1560 * its output to the added command (the pipe symbol in unix) 1561 */ 1562 public static Unix4jCommandBuilder sed(String regexp, String replacement, int... occurrence) { 1563 return builder().sed(regexp, replacement, occurrence); 1564 } 1565 /** 1566 * Executes the sed command specified by the given options or executes 1567 the print command p if no command option has been declared. 1568 * <p> 1569 * Note that the method returns the command builder to allow for command 1570 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1571 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1572 * 1573 * @param options Sed options and commands 1574 * @param regexp Regular expression matched against a line. 1575 * @return the command builder to allow for method chaining. Method 1576 * chaining is used here to create command chains. Adding a command 1577 * to the chain usually means that the previous command <i>pipes</i> 1578 * its output to the added command (the pipe symbol in unix) 1579 */ 1580 public static Unix4jCommandBuilder sed(SedOptions options, String regexp) { 1581 return builder().sed(options, regexp); 1582 } 1583 /** 1584 * Executes the sed command specified by the given options or executes 1585 the substitute command s if no command option has been declared. 1586 * <p> 1587 * Note that the method returns the command builder to allow for command 1588 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1589 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1590 * 1591 * @param options Sed options and commands 1592 * @param string1 Regular expression matched against a line for all commands except 1593 for command y where string1 contains the source characters for the 1594 translation. 1595 * @param string2 Replacement string for substitute command s; appended, inserted or 1596 changed text for a, i and c command; destination characters for 1597 translate command y; ignored by all other commands. 1598 <p> 1599 If string2 is a replacement string for the substitute command: the 1600 characters "$0" appearing in the replacement are replaced 1601 by the line matching the regexp; the characters "$n", where n is a 1602 digit other than zero, are replaced by the text matched by the 1603 corresponding backreference expression (aka group). The special 1604 meaning of "$n" in this context can be suppressed by preceding it 1605 by a backslash. 1606<p> 1607 (This operand only applies to the commands s, a, i, c and y and is 1608 ignored by all other commands). 1609 * @return the command builder to allow for method chaining. Method 1610 * chaining is used here to create command chains. Adding a command 1611 * to the chain usually means that the previous command <i>pipes</i> 1612 * its output to the added command (the pipe symbol in unix) 1613 */ 1614 public static Unix4jCommandBuilder sed(SedOptions options, String string1, String string2) { 1615 return builder().sed(options, string1, string2); 1616 } 1617 /** 1618 * Executes the sed command specified by the given options or executes 1619 the substitute command s if no command option has been declared. 1620 <p> 1621 The string1 operand usually contains the regular expression matched 1622 against a line for all commands except for command y where string1 1623 contains the source characters for the translation. 1624 <p> 1625 The string2 operand contains the replacement string for the 1626 substitute command s. It contains the appended, inserted or changed 1627 text for the commands a, i and c, respectively, and the destination 1628 characters for the translate command y. All other commands ignore 1629 the string2 operand. 1630 * <p> 1631 * Note that the method returns the command builder to allow for command 1632 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1633 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1634 * 1635 * @param options Sed options and commands 1636 * @param string1 Regular expression matched against a line for all commands except 1637 for command y where string1 contains the source characters for the 1638 translation. 1639 * @param string2 Replacement string for substitute command s; appended, inserted or 1640 changed text for a, i and c command; destination characters for 1641 translate command y; ignored by all other commands. 1642 <p> 1643 If string2 is a replacement string for the substitute command: the 1644 characters "$0" appearing in the replacement are replaced 1645 by the line matching the regexp; the characters "$n", where n is a 1646 digit other than zero, are replaced by the text matched by the 1647 corresponding backreference expression (aka group). The special 1648 meaning of "$n" in this context can be suppressed by preceding it 1649 by a backslash. 1650<p> 1651 (This operand only applies to the commands s, a, i, c and y and is 1652 ignored by all other commands). 1653 * @param occurrence Substitute for the given occurrences only of the regexp found within 1654 the matched string; the occurrence indices are one-based. If empty 1655 or omitted, all occurrences are substituted. 1656 <p> 1657 (This operand only applies to the substitute command and is ignored 1658 by all other commands). 1659 * @return the command builder to allow for method chaining. Method 1660 * chaining is used here to create command chains. Adding a command 1661 * to the chain usually means that the previous command <i>pipes</i> 1662 * its output to the added command (the pipe symbol in unix) 1663 */ 1664 public static Unix4jCommandBuilder sed(SedOptions options, String string1, String string2, int... occurrence) { 1665 return builder().sed(options, string1, string2, occurrence); 1666 } 1667 /** 1668 * Sort the lines of all the specified files together and writes the 1669 result to the standard output. 1670 <p> 1671 Options can be specified by acronym (with a leading dash "-") or by 1672 long name (with two leading dashes "--"). Operands other than the 1673 default "--paths" operand have to be prefixed with the operand 1674 name. 1675 <p> 1676 The sort algorithm used is guaranteed to be stable: lines considered 1677 equal will not be reordered as a result of the sort. If two lines 1678 originate from different input files, the index of the file in the 1679 input arguments list defines the ordering of the lines. 1680 * <p> 1681 * Note that the method returns the command builder to allow for command 1682 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1683 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1684 * 1685 * @param args String arguments defining the options and operands for the command. 1686 Options can be specified by acronym (with a leading dash "-") or by 1687 long name (with two leading dashes "--"). Operands other than the 1688 default "--paths" operand have to be prefixed with the operand 1689 name (e.g. "--comparator" for a subsequent comparator operand value). 1690 * @return the command builder to allow for method chaining. Method 1691 * chaining is used here to create command chains. Adding a command 1692 * to the chain usually means that the previous command <i>pipes</i> 1693 * its output to the added command (the pipe symbol in unix) 1694 */ 1695 public static Unix4jCommandBuilder sort(String... args) { 1696 return builder().sort(args); 1697 } 1698 /** 1699 * Sort the lines of all the specified files together and writes the 1700 result to the standard output. 1701 <p> 1702 Comparisons are based on the entire line without line ending. The 1703 collating sequence of the current locale is used to perform the 1704 comparisons. 1705 <p> 1706 The sort algorithm used is guaranteed to be stable: lines considered 1707 equal will not be reordered as a result of the sort. If two lines 1708 originate from different input files, the index of the file in the 1709 input arguments list defines the ordering of the lines. 1710 * <p> 1711 * Note that the method returns the command builder to allow for command 1712 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1713 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1714 * 1715 * @param files The files to be sorted or merged; relative paths are not resolved 1716 (use the string paths argument to enable relative path resolving 1717 based on the current working directory). 1718 * @return the command builder to allow for method chaining. Method 1719 * chaining is used here to create command chains. Adding a command 1720 * to the chain usually means that the previous command <i>pipes</i> 1721 * its output to the added command (the pipe symbol in unix) 1722 */ 1723 public static Unix4jCommandBuilder sort(java.io.File... files) { 1724 return builder().sort(files); 1725 } 1726 /** 1727 * Sort the lines of all the specified files together and writes the 1728 result to the standard output. 1729 <p> 1730 Line comparisons are based on the specified {@code comparator}. 1731 <p> 1732 The sort algorithm used is guaranteed to be stable: lines considered 1733 equal will not be reordered as a result of the sort. If two lines 1734 originate from different input files, the index of the file in the 1735 input arguments list defines the ordering of the lines. 1736 * <p> 1737 * Note that the method returns the command builder to allow for command 1738 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1739 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1740 * 1741 * @param comparator The comparator to use for the line comparisons. 1742 * @param files The files to be sorted or merged; relative paths are not resolved 1743 (use the string paths argument to enable relative path resolving 1744 based on the current working directory). 1745 * @return the command builder to allow for method chaining. Method 1746 * chaining is used here to create command chains. Adding a command 1747 * to the chain usually means that the previous command <i>pipes</i> 1748 * its output to the added command (the pipe symbol in unix) 1749 */ 1750 public static Unix4jCommandBuilder sort(java.util.Comparator<? super org.unix4j.line.Line> comparator, java.io.File... files) { 1751 return builder().sort(comparator, files); 1752 } 1753 /** 1754 * Sort the lines of all the specified files together and writes the 1755 result to the standard output. 1756 <p> 1757 Line comparisons are based on the specified {@code comparator}. 1758 <p> 1759 The sort algorithm used is guaranteed to be stable: lines considered 1760 equal will not be reordered as a result of the sort. If two lines 1761 originate from different input files, the index of the file in the 1762 input arguments list defines the ordering of the lines. 1763 * <p> 1764 * Note that the method returns the command builder to allow for command 1765 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1766 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1767 * 1768 * @param comparator The comparator to use for the line comparisons. 1769 * @param paths Pathnames of the files to be sorted, merged, or checked; wildcards * 1770 and ? are supported; relative paths are resolved on the 1771 basis of the current working directory. 1772 * @return the command builder to allow for method chaining. Method 1773 * chaining is used here to create command chains. Adding a command 1774 * to the chain usually means that the previous command <i>pipes</i> 1775 * its output to the added command (the pipe symbol in unix) 1776 */ 1777 public static Unix4jCommandBuilder sort(java.util.Comparator<? super org.unix4j.line.Line> comparator, String... paths) { 1778 return builder().sort(comparator, paths); 1779 } 1780 /** 1781 * Sorts, merges, or sequence checks the lines the lines of all the 1782 specified files together and writes the result to the standard 1783 output. 1784 <p> 1785 Comparisons are based on the entire line without line ending. The 1786 collating sequence of the current locale is used to perform the 1787 comparisons. 1788 <p> 1789 The sort algorithm used is guaranteed to be stable: lines considered 1790 equal will not be reordered as a result of the sort. If two lines 1791 originate from different input files, the index of the file in the 1792 input arguments list defines the ordering of the lines. 1793 * <p> 1794 * Note that the method returns the command builder to allow for command 1795 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1796 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1797 * 1798 * @param options The options for the sort command. 1799 * @param files The files to be sorted or merged; relative paths are not resolved 1800 (use the string paths argument to enable relative path resolving 1801 based on the current working directory). 1802 * @return the command builder to allow for method chaining. Method 1803 * chaining is used here to create command chains. Adding a command 1804 * to the chain usually means that the previous command <i>pipes</i> 1805 * its output to the added command (the pipe symbol in unix) 1806 */ 1807 public static Unix4jCommandBuilder sort(SortOptions options, java.io.File... files) { 1808 return builder().sort(options, files); 1809 } 1810 /** 1811 * Sorts, merges, or sequence checks the lines the lines of all the 1812 specified files together and writes the result to the standard 1813 output. 1814 <p> 1815 Comparisons are based on the entire line without line ending. The 1816 collating sequence of the current locale is used to perform the 1817 comparisons. 1818 <p> 1819 The sort algorithm used is guaranteed to be stable: lines considered 1820 equal will not be reordered as a result of the sort. If two lines 1821 originate from different input files, the index of the file in the 1822 input arguments list defines the ordering of the lines. 1823 * <p> 1824 * Note that the method returns the command builder to allow for command 1825 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1826 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1827 * 1828 * @param options The options for the sort command. 1829 * @param paths Pathnames of the files to be sorted, merged, or checked; wildcards * 1830 and ? are supported; relative paths are resolved on the 1831 basis of the current working directory. 1832 * @return the command builder to allow for method chaining. Method 1833 * chaining is used here to create command chains. Adding a command 1834 * to the chain usually means that the previous command <i>pipes</i> 1835 * its output to the added command (the pipe symbol in unix) 1836 */ 1837 public static Unix4jCommandBuilder sort(SortOptions options, String... paths) { 1838 return builder().sort(options, paths); 1839 } 1840 /** 1841 * Sorts, merges, or sequence checks the lines the lines of all the 1842 specified files together and writes the result to the standard 1843 output. 1844 <p> 1845 Line comparisons are based on the specified {@code comparator}. 1846 All comparison related options except for {@code --reverse} are 1847 ignored. 1848 <p> 1849 The sort algorithm used is guaranteed to be stable: lines considered 1850 equal will not be reordered as a result of the sort. If two lines 1851 originate from different input files, the index of the file in the 1852 input arguments list defines the ordering of the lines. 1853 * <p> 1854 * Note that the method returns the command builder to allow for command 1855 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1856 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1857 * 1858 * @param options The options for the sort command. 1859 * @param comparator The comparator to use for the line comparisons. 1860 * @param files The files to be sorted or merged; relative paths are not resolved 1861 (use the string paths argument to enable relative path resolving 1862 based on the current working directory). 1863 * @return the command builder to allow for method chaining. Method 1864 * chaining is used here to create command chains. Adding a command 1865 * to the chain usually means that the previous command <i>pipes</i> 1866 * its output to the added command (the pipe symbol in unix) 1867 */ 1868 public static Unix4jCommandBuilder sort(SortOptions options, java.util.Comparator<? super org.unix4j.line.Line> comparator, java.io.File... files) { 1869 return builder().sort(options, comparator, files); 1870 } 1871 /** 1872 * Sorts, merges, or sequence checks the lines the lines of all the 1873 specified files together and writes the result to the standard 1874 output. 1875 <p> 1876 Line comparisons are based on the specified {@code comparator}. 1877 All comparison related options except for {@code --reverse} are 1878 ignored. 1879 <p> 1880 The sort algorithm used is guaranteed to be stable: lines considered 1881 equal will not be reordered as a result of the sort. If two lines 1882 originate from different input files, the index of the file in the 1883 input arguments list defines the ordering of the lines. 1884 * <p> 1885 * Note that the method returns the command builder to allow for command 1886 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1887 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1888 * 1889 * @param options The options for the sort command. 1890 * @param comparator The comparator to use for the line comparisons. 1891 * @param paths Pathnames of the files to be sorted, merged, or checked; wildcards * 1892 and ? are supported; relative paths are resolved on the 1893 basis of the current working directory. 1894 * @return the command builder to allow for method chaining. Method 1895 * chaining is used here to create command chains. Adding a command 1896 * to the chain usually means that the previous command <i>pipes</i> 1897 * its output to the added command (the pipe symbol in unix) 1898 */ 1899 public static Unix4jCommandBuilder sort(SortOptions options, java.util.Comparator<? super org.unix4j.line.Line> comparator, String... paths) { 1900 return builder().sort(options, comparator, paths); 1901 } 1902 /** 1903 * Reads the last n lines from each of the files specified and writes 1904 them to the standard output. If more than a single file is 1905 specified, each file is preceded by a header consisting of the 1906 string {@code "==> XXX <=="} where {@code "XXX"} is the name 1907 of the file. 1908<p> 1909 Options can be specified by acronym (with a leading dash "-") or by 1910 long name (with two leading dashes "--"). Operands other than the 1911 default "--paths" operand have to be prefixed with the operand 1912 name. 1913 * <p> 1914 * Note that the method returns the command builder to allow for command 1915 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1916 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1917 * 1918 * @param args String arguments defining the options and operands for the command. 1919 Options can be specified by acronym (with a leading dash "-") or by 1920 long name (with two leading dashes "--"). Operands other than the 1921 default "--paths" operand have to be prefixed with the operand 1922 name (e.g. "--count" for a subsequent count operand value). 1923 * @return the command builder to allow for method chaining. Method 1924 * chaining is used here to create command chains. Adding a command 1925 * to the chain usually means that the previous command <i>pipes</i> 1926 * its output to the added command (the pipe symbol in unix) 1927 */ 1928 public static Unix4jCommandBuilder tail(String... args) { 1929 return builder().tail(args); 1930 } 1931 /** 1932 * Reads the last 10 lines from each of the specified files and writes 1933 them to the standard output. If more than a single file is 1934 specified, each file is preceded by a header consisting of the 1935 string {@code "==> XXX <=="} where {@code "XXX"} is the name 1936 of the file. 1937 * <p> 1938 * Note that the method returns the command builder to allow for command 1939 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1940 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1941 * 1942 * @param files The input files to be filtered; relative paths are not resolved (use 1943 the string paths argument to enable relative path resolving based on 1944 the current working directory). 1945 * @return the command builder to allow for method chaining. Method 1946 * chaining is used here to create command chains. Adding a command 1947 * to the chain usually means that the previous command <i>pipes</i> 1948 * its output to the added command (the pipe symbol in unix) 1949 */ 1950 public static Unix4jCommandBuilder tail(java.io.File... files) { 1951 return builder().tail(files); 1952 } 1953 /** 1954 * Reads the last {@code count} lines from each of the specified files 1955 and writes them to the standard output. If more than a single file 1956 is specified, each file is preceded by a header consisting of the 1957 string {@code "==> XXX <=="} where {@code "XXX"} is the name 1958 of the file. 1959 * <p> 1960 * Note that the method returns the command builder to allow for command 1961 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1962 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1963 * 1964 * @param count The last {@code count} lines of each input file are 1965 copied to standard output, starting from 1 (characters instead of 1966 lines if the {@code -c} option is specified, and offset from start 1967 instead of end with {@code -s} option). Must be a non-negative 1968 integer or an exception is thrown. If {@code count} is greater than 1969 the number number of lines (characters) in the input, the 1970 application will not error and send the whole file to the output. 1971 * @param files The input files to be filtered; relative paths are not resolved (use 1972 the string paths argument to enable relative path resolving based on 1973 the current working directory). 1974 * @return the command builder to allow for method chaining. Method 1975 * chaining is used here to create command chains. Adding a command 1976 * to the chain usually means that the previous command <i>pipes</i> 1977 * its output to the added command (the pipe symbol in unix) 1978 */ 1979 public static Unix4jCommandBuilder tail(long count, java.io.File... files) { 1980 return builder().tail(count, files); 1981 } 1982 /** 1983 * Reads the last {@code count} lines from each of the specified files 1984 and writes them to the standard output. If more than a single file 1985 is specified, each file is preceded by a header consisting of the 1986 string {@code "==> XXX <=="} where {@code "XXX"} is the name 1987 of the file. 1988 * <p> 1989 * Note that the method returns the command builder to allow for command 1990 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1991 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1992 * 1993 * @param count The last {@code count} lines of each input file are 1994 copied to standard output, starting from 1 (characters instead of 1995 lines if the {@code -c} option is specified, and offset from start 1996 instead of end with {@code -s} option). Must be a non-negative 1997 integer or an exception is thrown. If {@code count} is greater than 1998 the number number of lines (characters) in the input, the 1999 application will not error and send the whole file to the output. 2000 * @param paths Pathnames of the input files to be filtered; wildcards * and ? are 2001 supported; relative paths are resolved on the basis of the current 2002 working directory. 2003 * @return the command builder to allow for method chaining. Method 2004 * chaining is used here to create command chains. Adding a command 2005 * to the chain usually means that the previous command <i>pipes</i> 2006 * its output to the added command (the pipe symbol in unix) 2007 */ 2008 public static Unix4jCommandBuilder tail(long count, String... paths) { 2009 return builder().tail(count, paths); 2010 } 2011 /** 2012 * Reads the last {@code count} lines or characters from each of the 2013 specified files and writes them to the standard output. If more than 2014 a single file is specified and the {@code -q} option is not 2015 specified, each file is preceded by a header consisting of the 2016 string {@code "==> XXX <=="} where {@code "XXX"} is the name 2017 of the file. 2018 * <p> 2019 * Note that the method returns the command builder to allow for command 2020 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2021 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2022 * 2023 * @param options Options for the tail command. 2024 * @param count The last {@code count} lines of each input file are 2025 copied to standard output, starting from 1 (characters instead of 2026 lines if the {@code -c} option is specified, and offset from start 2027 instead of end with {@code -s} option). Must be a non-negative 2028 integer or an exception is thrown. If {@code count} is greater than 2029 the number number of lines (characters) in the input, the 2030 application will not error and send the whole file to the output. 2031 * @param files The input files to be filtered; relative paths are not resolved (use 2032 the string paths argument to enable relative path resolving based on 2033 the current working directory). 2034 * @return the command builder to allow for method chaining. Method 2035 * chaining is used here to create command chains. Adding a command 2036 * to the chain usually means that the previous command <i>pipes</i> 2037 * its output to the added command (the pipe symbol in unix) 2038 */ 2039 public static Unix4jCommandBuilder tail(TailOptions options, long count, java.io.File... files) { 2040 return builder().tail(options, count, files); 2041 } 2042 /** 2043 * Reads the last {@code count} lines or characters from each of the 2044 specified files and writes them to the standard output. If more than 2045 a single file is specified and the {@code -q} option is not 2046 specified, each file is preceded by a header consisting of the 2047 string {@code "==> XXX <=="} where {@code "XXX"} is the name 2048 of the file. 2049 * <p> 2050 * Note that the method returns the command builder to allow for command 2051 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2052 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2053 * 2054 * @param options Options for the tail command. 2055 * @param count The last {@code count} lines of each input file are 2056 copied to standard output, starting from 1 (characters instead of 2057 lines if the {@code -c} option is specified, and offset from start 2058 instead of end with {@code -s} option). Must be a non-negative 2059 integer or an exception is thrown. If {@code count} is greater than 2060 the number number of lines (characters) in the input, the 2061 application will not error and send the whole file to the output. 2062 * @param paths Pathnames of the input files to be filtered; wildcards * and ? are 2063 supported; relative paths are resolved on the basis of the current 2064 working directory. 2065 * @return the command builder to allow for method chaining. Method 2066 * chaining is used here to create command chains. Adding a command 2067 * to the chain usually means that the previous command <i>pipes</i> 2068 * its output to the added command (the pipe symbol in unix) 2069 */ 2070 public static Unix4jCommandBuilder tail(TailOptions options, long count, String... paths) { 2071 return builder().tail(options, count, paths); 2072 } 2073 /** 2074 * Reads from the specified input {@code file} and compares adjacent 2075 lines, writing one copy of each input line to the standard output. 2076 The second and succeeding copies of repeated adjacent input lines 2077 are not written to the output. 2078 <p> 2079 Note that repeated lines in the input are not detected if they are 2080 not adjacent (see --global or -g option); sorted input lines always 2081 result in unique output lines. 2082 * <p> 2083 * Note that the method returns the command builder to allow for command 2084 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2085 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2086 * 2087 * @param file The files or directories used as starting point for the listing; 2088 relative paths are not resolved (use the string path argument to 2089 enable relative path resolving based on the current working 2090 directory). 2091 * @return the command builder to allow for method chaining. Method 2092 * chaining is used here to create command chains. Adding a command 2093 * to the chain usually means that the previous command <i>pipes</i> 2094 * its output to the added command (the pipe symbol in unix) 2095 */ 2096 public static Unix4jCommandBuilder uniq(java.io.File file) { 2097 return builder().uniq(file); 2098 } 2099 /** 2100 * Reads the file specified by its {@code path} and compares adjacent 2101 lines, writing one copy of each input line to the standard output. 2102 The second and succeeding copies of repeated adjacent input lines 2103 are not written to the output. 2104 <p> 2105 Note that repeated lines in the input are not detected if they are 2106 not adjacent (see --global or -g option); sorted input lines always 2107 result in unique output lines. 2108 * <p> 2109 * Note that the method returns the command builder to allow for command 2110 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2111 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2112 * 2113 * @param path The files or directories used as starting point for the listing; 2114 wildcards * and ? are supported; relative paths are resolved on the 2115 basis of the current working directory. 2116 * @return the command builder to allow for method chaining. Method 2117 * chaining is used here to create command chains. Adding a command 2118 * to the chain usually means that the previous command <i>pipes</i> 2119 * its output to the added command (the pipe symbol in unix) 2120 */ 2121 public static Unix4jCommandBuilder uniq(String path) { 2122 return builder().uniq(path); 2123 } 2124 /** 2125 * Reads from the specified input {@code file} and compares adjacent 2126 lines, writing one copy of each input line to the standard output. 2127 The second and succeeding copies of repeated adjacent input lines 2128 are not written to the output. 2129 <p> 2130 Note that repeated non-adjacent lines in the input are only detected 2131 with the --global or -g option. In other words, unique output lines 2132 are guaranteed only if either (a) the --global or -g option is 2133 specified, or (b) the input lines are sorted. 2134 * <p> 2135 * Note that the method returns the command builder to allow for command 2136 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2137 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2138 * 2139 * @param options The options defining the uniqueness details for the output lines. 2140 * @param file The files or directories used as starting point for the listing; 2141 relative paths are not resolved (use the string path argument to 2142 enable relative path resolving based on the current working 2143 directory). 2144 * @return the command builder to allow for method chaining. Method 2145 * chaining is used here to create command chains. Adding a command 2146 * to the chain usually means that the previous command <i>pipes</i> 2147 * its output to the added command (the pipe symbol in unix) 2148 */ 2149 public static Unix4jCommandBuilder uniq(UniqOptions options, java.io.File file) { 2150 return builder().uniq(options, file); 2151 } 2152 /** 2153 * Reads the file specified by its {@code path} and compares adjacent 2154 lines, writing one copy of each input line to the standard output. 2155 The second and succeeding copies of repeated adjacent input lines 2156 are not written to the output. 2157 <p> 2158 Note that repeated non-adjacent lines in the input are only detected 2159 with the --global or -g option. In other words, unique output lines 2160 are guaranteed only if either (a) the --global or -g option is 2161 specified, or (b) the input lines are sorted. 2162 * <p> 2163 * Note that the method returns the command builder to allow for command 2164 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2165 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2166 * 2167 * @param options The options defining the uniqueness details for the output lines. 2168 * @param path The files or directories used as starting point for the listing; 2169 wildcards * and ? are supported; relative paths are resolved on the 2170 basis of the current working directory. 2171 * @return the command builder to allow for method chaining. Method 2172 * chaining is used here to create command chains. Adding a command 2173 * to the chain usually means that the previous command <i>pipes</i> 2174 * its output to the added command (the pipe symbol in unix) 2175 */ 2176 public static Unix4jCommandBuilder uniq(UniqOptions options, String path) { 2177 return builder().uniq(options, path); 2178 } 2179 /** 2180 * Executes a count of lines, words and chars contained in each input 2181 file and writes them to the standard output. If more than one input 2182 file is specified, a line of cumulative counts for all the files is 2183 displayed on a separate line after the output for the last file. 2184 * <p> 2185 * Note that the method returns the command builder to allow for command 2186 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2187 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2188 * 2189 * @param files The input files; relative paths are not resolved (use the string 2190 paths argument to enable relative path resolving based on the 2191 current working directory). 2192 * @return the command builder to allow for method chaining. Method 2193 * chaining is used here to create command chains. Adding a command 2194 * to the chain usually means that the previous command <i>pipes</i> 2195 * its output to the added command (the pipe symbol in unix) 2196 */ 2197 public static Unix4jCommandBuilder wc(java.io.File... files) { 2198 return builder().wc(files); 2199 } 2200 /** 2201 * Executes a one or more counts, depending on the given options, in 2202 each of the given input files and writes them to the standard 2203 output. If more than one input file is specified, a line of 2204 cumulative counts for all the files is displayed on a separate line 2205 after the output for the last file. 2206 * <p> 2207 * Note that the method returns the command builder to allow for command 2208 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2209 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2210 * 2211 * @param options The options defining command behavior. 2212 * @param files The input files; relative paths are not resolved (use the string 2213 paths argument to enable relative path resolving based on the 2214 current working directory). 2215 * @return the command builder to allow for method chaining. Method 2216 * chaining is used here to create command chains. Adding a command 2217 * to the chain usually means that the previous command <i>pipes</i> 2218 * its output to the added command (the pipe symbol in unix) 2219 */ 2220 public static Unix4jCommandBuilder wc(WcOptions options, java.io.File... files) { 2221 return builder().wc(options, files); 2222 } 2223 /** 2224 * Executes a one or more counts, depending on the given options, in 2225 each of the given input files and writes them to the standard 2226 output. If more than one input file is specified, a line of 2227 cumulative counts for all the files is displayed on a separate line 2228 after the output for the last file. 2229 * <p> 2230 * Note that the method returns the command builder to allow for command 2231 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2232 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2233 * 2234 * @param options The options defining command behavior. 2235 * @param paths Pathnames of the input files; wildcards * and ? are supported; 2236 relative paths are resolved on the basis of the current working 2237 directory. 2238 * @return the command builder to allow for method chaining. Method 2239 * chaining is used here to create command chains. Adding a command 2240 * to the chain usually means that the previous command <i>pipes</i> 2241 * its output to the added command (the pipe symbol in unix) 2242 */ 2243 public static Unix4jCommandBuilder wc(WcOptions options, String[] paths) { 2244 return builder().wc(options, paths); 2245 } 2246 2247 // no instances 2248 private Unix4j() { 2249 super(); 2250 } 2251}