split.1 (348238dbd42306d9fb5d89ab393b840572cfeb0f) | split.1 (e48cafb55ddaa7ac3ed73ddf25b8019531c83d71) |
---|---|
1.\" Copyright (c) 1990, 1991, 1993, 1994 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. --- 108 unchanged lines hidden (view full) --- 117.It Fl l Ar line_count 118Create split files 119.Ar line_count 120lines in length. 121.It Fl n Ar chunk_count 122Split file into 123.Ar chunk_count 124smaller files. | 1.\" Copyright (c) 1990, 1991, 1993, 1994 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. --- 108 unchanged lines hidden (view full) --- 117.It Fl l Ar line_count 118Create split files 119.Ar line_count 120lines in length. 121.It Fl n Ar chunk_count 122Split file into 123.Ar chunk_count 124smaller files. |
125The first n - 1 files will be of size (size of 126.Ar file 127/ 128.Ar chunk_count 129) 130and the last file will contain the remaining bytes. |
|
125.It Fl p Ar pattern 126The file is split whenever an input line matches 127.Ar pattern , 128which is interpreted as an extended regular expression. 129The matching line will be the first line of the next output file. 130This option is incompatible with the 131.Fl b 132and --- 26 unchanged lines hidden (view full) --- 159and 160.Ev LC_COLLATE 161environment variables affect the execution of 162.Nm 163as described in 164.Xr environ 7 . 165.Sh EXIT STATUS 166.Ex -std | 131.It Fl p Ar pattern 132The file is split whenever an input line matches 133.Ar pattern , 134which is interpreted as an extended regular expression. 135The matching line will be the first line of the next output file. 136This option is incompatible with the 137.Fl b 138and --- 26 unchanged lines hidden (view full) --- 165and 166.Ev LC_COLLATE 167environment variables affect the execution of 168.Nm 169as described in 170.Xr environ 7 . 171.Sh EXIT STATUS 172.Ex -std |
173.Sh EXAMPLES 174Split input into as many files as needed, so that each file contains at most 2 175lines: 176.Bd -literal -offset indent 177$ echo -e "first line\\nsecond line\\nthird line\\nforth line" | split -l2 178.Ed 179.Pp 180Split input in chunks of 10 bytes using numeric prefixes for file names. 181This generates two files of 10 bytes (x00 and x01) and a third file (x02) with the 182remaining 2 bytes: 183.Bd -literal -offset indent 184$ echo -e "This is 22 bytes long" | split -d -b10 185.Ed 186.Pp 187Split input generating 6 files: 188.Bd -literal -offset indent 189echo -e "This is 22 bytes long" | split -n 6 190.Ed 191.Pp 192Split input creating a new file every time a line matches the regular expression 193for a 194.Dq t 195followed by either 196.Dq a 197or 198.Dq u 199thus creating two files: 200.Bd -literal -offset indent 201$ echo -e "stack\\nstock\\nstuck\\nanother line" | split -p 't[au]' 202.Ed |
|
167.Sh SEE ALSO 168.Xr csplit 1 , 169.Xr re_format 7 170.Sh STANDARDS 171The 172.Nm 173utility conforms to 174.St -p1003.1-2001 . 175.Sh HISTORY 176A 177.Nm 178command appeared in 179.At v3 . 180.Sh BUGS 181The maximum line length for matching patterns is 65536. | 203.Sh SEE ALSO 204.Xr csplit 1 , 205.Xr re_format 7 206.Sh STANDARDS 207The 208.Nm 209utility conforms to 210.St -p1003.1-2001 . 211.Sh HISTORY 212A 213.Nm 214command appeared in 215.At v3 . 216.Sh BUGS 217The maximum line length for matching patterns is 65536. |