diff options
author | Giorgos Keramidas <keramida@FreeBSD.org> | 2006-08-08 21:25:22 +0000 |
---|---|---|
committer | Giorgos Keramidas <keramida@FreeBSD.org> | 2006-08-08 21:25:22 +0000 |
commit | 49198c429758b2bca2854d3748a4c6cfaf6cc633 (patch) | |
tree | 616ff8a9a61a4572d2b05477d174bf3fe81d1bce /usr.bin | |
parent | 49953e11d7e84e790dec99d55962e7059757b3bf (diff) | |
download | src-test2-49198c429758b2bca2854d3748a4c6cfaf6cc633.tar.gz src-test2-49198c429758b2bca2854d3748a4c6cfaf6cc633.zip |
Notes
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/split/split.1 | 32 | ||||
-rw-r--r-- | usr.bin/split/split.c | 16 |
2 files changed, 30 insertions, 18 deletions
diff --git a/usr.bin/split/split.1 b/usr.bin/split/split.1 index 5b174329d9b6..afd7dc4d11ac 100644 --- a/usr.bin/split/split.1 +++ b/usr.bin/split/split.1 @@ -32,7 +32,7 @@ .\" @(#)split.1 8.3 (Berkeley) 4/16/94 .\" $FreeBSD$ .\" -.Dd August 21, 2005 +.Dd August 9, 2006 .Dt SPLIT 1 .Os .Sh NAME @@ -40,17 +40,29 @@ .Nd split a file into pieces .Sh SYNOPSIS .Nm -.Op Fl a Ar suffix_length -.Op Fl b Ar byte_count Ns Op Cm k Ns | Ns Cm m .Op Fl l Ar line_count -.Op Fl p Ar pattern -.Op Ar file Op Ar name +.Op Fl a Ar suffix_length +.Op Ar file Op Ar prefix +.Nm +.Fl b Ar byte_count Ns +.Oo +.Cm k Ns | Ns Cm m +.Oc +.Op Fl a Ar suffix_length +.Op Ar file Op Ar prefix +.Nm +.Fl p Ar pattern +.Op Fl a Ar suffix_length +.Op Ar file Op Ar prefix .Sh DESCRIPTION The .Nm utility reads the given .Ar file -and breaks it up into files of 1000 lines each. +and breaks it up into files of 1000 lines each +(if no options are specified), leaving the +.Ar file +unchanged. If .Ar file is a single dash @@ -60,7 +72,7 @@ or absent, reads from the standard input. .Pp The options are as follows: -.Bl -tag -width Ds +.Bl -tag -width indent .It Fl a Ar suffix_length Use .Ar suffix_length @@ -81,7 +93,7 @@ is appended to the number, the file is split into megabyte pieces. .It Fl l Ar line_count Create smaller files -.Ar n +.Ar line_count lines in length. .It Fl p Ar pattern The file is split whenever an input line matches @@ -103,13 +115,13 @@ In this case, each file into which the file is split is named by the prefix followed by a lexically ordered suffix using .Ar suffix_length characters in the range -.Dq Li a-z . +.Dq Li a Ns - Ns Li z . If .Fl a is not specified, two letters are used as the suffix. .Pp If the -.Ar name +.Ar prefix argument is not specified, the file is split into lexically ordered files named with the prefix .Dq Li x diff --git a/usr.bin/split/split.c b/usr.bin/split/split.c index 906d07a0ed8d..71b47c739978 100644 --- a/usr.bin/split/split.c +++ b/usr.bin/split/split.c @@ -130,11 +130,6 @@ main(int argc, char **argv) errx(EX_USAGE, "%s: offset too large", optarg); bytecnt = (off_t)(bytecnti * scale); break; - case 'p' : /* pattern matching. */ - if (regcomp(&rgx, optarg, REG_EXTENDED|REG_NOSUB) != 0) - errx(EX_USAGE, "%s: illegal regexp", optarg); - pflag = 1; - break; case 'l': /* Line count. */ if (numlines != 0) usage(); @@ -142,6 +137,11 @@ main(int argc, char **argv) errx(EX_USAGE, "%s: illegal line count", optarg); break; + case 'p': /* pattern matching. */ + if (regcomp(&rgx, optarg, REG_EXTENDED|REG_NOSUB) != 0) + errx(EX_USAGE, "%s: illegal regexp", optarg); + pflag = 1; + break; default: usage(); } @@ -335,8 +335,8 @@ static void usage(void) { (void)fprintf(stderr, -"usage: split [-a sufflen] [-b byte_count] [-l line_count] [-p pattern]\n"); - (void)fprintf(stderr, -" [file [prefix]]\n"); +"usage: split [-l line_count] [-a suffix_length] [file [prefix]]\n" +" split -b byte_count[k|m] [-a suffix_length] [file [prefix]]\n" +" split -p pattern [-a suffix_length] [file [prefix]]\n"); exit(EX_USAGE); } |