Here is a shell script that calls a perl script to split a file. The contents of the split results are not uniform in number, but they seem somewhat balanced. It works on small datasets like the sample, but whether it would work on a very large dataset is unknown -- for example, it may be limited by memory. This is a quickly written solution, and if you are curious, you'd need to look over the documentation and code, and / or contact the author the perl module Text::Parts:
producing:
Best wishes ... cheers, drl
Hi,
I'am using HP-UX.I have a input file which has 102 drop statements in it.I'am using csplit to split the files.The upper limit is 99 only.I'am using the -n 102 option.It says "suffix size not vaild".Any suggestions how to do it using csplit?
Thanx in advance,
sounder. (1 Reply)
Hi Unix gurus,
We have a masterfile which is to be split into smallerfiles with names as
masterfile00,masterfile01,masterfile03...etal
I was able to split the file using the "Split" cmd
but as masterfileaa,masterfileab..
Is it posiible to change the default suffix?
or is there any other... (2 Replies)
Hi,
I needs to split *.txt files from single directory depends on the some mutltiple input values. i have wrote the code like below
for file in *.txt
do
grep -i -h "value1|value2" $file > $file;
done.
My requirment is more input values needs to be given in grep; let us say 50... (3 Replies)
Hi,
I have some files with 2 million odd records which i need to split into chunks of 0.5 millions. I have the file sorted with a key column in order. The same key value can appear as 4 or 5 records in the file.
Hence after splitting we are checking whether all the key values are present in the... (5 Replies)
Hi,
I have an input file like:
111
abcdefgh
asdfghjk
dfghjkl
222
aaaaaaa
bbbbbb
333
djfhfgjktitjhgfkg
444
djdhfjkhfjkghjkfg
hsbfjksdbhjkgherjklg
fjkhfjklsahjgh
fkrjkgnj
I want to read this input file and make separate output files with the header as numric value like "111"... (9 Replies)
Hi Gurus,
Lets say i have a file with some 30 records...
How can i split that file into 3 files
Also it shud be dynamic in the sense..
I wouldnt mind if file 1 has 15, file 2 has 10 and file 3 has 5....
Please help..
Thanks (6 Replies)
I want a script to split my file upon the last field (15)
As file
A,b,c,.......,01
C,v,n,.......,02
C,r,v,........,01
F,s,a,........,03
X,y,d,........,99
To make output
01.txt
A,b,c,.......,01
C,r,v,........,01
02.txt
C,v,n,.......,02 (12 Replies)
I am trying to split my IRSSI logs into weekly and monthly .log files. My log format looks like this:
--- Day changed Fri Mar 04 2016
00:11 <Jack> Test
--- Day changed Sat Mar 05 2016
00:11 <Jack> Test
--- Day changed Sun Mar 06 2016
15:20 <Jack> Test
The script I have been playing... (2 Replies)
i use the split command to split a one terabyte backup file into 10 chunks of 100 GB each. The files are split one after the other. While the files is being split, I will like to scp the files one after the other as soon as the previous one completes, from server A to Server B. Then on server B ,... (2 Replies)
Discussion started by: malaika
2 Replies
LEARN ABOUT OPENSOLARIS
split
split(1T) Tcl Built-In Commands split(1T)__________________________________________________________________________________________________________________________________________________NAME
split - Split a string into a proper Tcl list
SYNOPSIS
split string ?splitChars?
_________________________________________________________________DESCRIPTION
Returns a list created by splitting string at each character that is in the splitChars argument. Each element of the result list will con-
sist of the characters from string that lie between instances of the characters in splitChars. Empty list elements will be generated if
string contains adjacent characters in splitChars, or if the first or last character of string is in splitChars. If splitChars is an empty
string then each character of string becomes a separate element of the result list. SplitChars defaults to the standard white-space char-
acters.
EXAMPLES
Divide up a USENET group name into its hierarchical components:
split "comp.lang.tcl.announce" .
=> comp lang tcl announce
See how the split command splits on every character in splitChars, which can result in information loss if you are not careful:
split "alpha beta gamma" "temp"
=> al {ha b} {} {a ga} {} a
Extract the list words from a string that is not a well-formed list:
split "Example with {unbalanced brace character"
=> Example with {unbalanced brace character
Split a string into its constituent characters
split "Hello world" {}
=> H e l l o { } w o r l d
PARSING RECORD-ORIENTED FILES
Parse a Unix /etc/passwd file, which consists of one entry per line, with each line consisting of a colon-separated list of fields:
## Read the file
set fid [open /etc/passwd]
set content [read $fid]
close $fid
## Split into records on newlines
set records [split $content "
"]
## Iterate over the records
foreach rec $records {
## Split into fields on colons
set fields [split $rec ":"]
## Assign fields to variables and print some out...
lassign $fields
userName password uid grp longName homeDir shell
puts "$longName uses [file tail $shell] for a login shell"
}
SEE ALSO join(1T), list(1T), string(1T)KEYWORDS
list, split, string
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+--------------------+-----------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+--------------------+-----------------+
|Availability | SUNWTcl |
+--------------------+-----------------+
|Interface Stability | Uncommitted |
+--------------------+-----------------+
NOTES
Source for Tcl is available on http://opensolaris.org.
Tclsplit(1T)