09-02-2009
What Operating System and version do you use?
Does your version of the "split" command have the "-a" switch? See "man split".
Splitting he files twice is indeed twice the work. Using shell script for serious data processing has its merits for quick development of one-off jobs and prototypes. For a regular job on this scale personally I would choose a high level language which has no issues in closing file descriptors mid-process.
I am intrigued why you would want to break 10,000,000 records into 5,000 record chunks? To my mind it just creates complications in volume processing.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I want to split a file containing millions of records.
I am issuing the command
split -l 20000 filename which will split the file in 20K records each.
It works fine except in some files, data after one particular field is lost( the field with space).
Say the record is ... (4 Replies)
Discussion started by: superprogrammer
4 Replies
2. UNIX for Dummies Questions & Answers
I have gone through all the threads in the forum and tested out different things. I am trying to split a 3GB file into multiple files. Some files are even larger than this.
For example:
split -l 3000000 filename.txt
This is very slow and it splits the file with 3 million records in each... (10 Replies)
Discussion started by: madhunk
10 Replies
3. Shell Programming and Scripting
Hi all,
i have a .ksh script which is, among other stuff, splitting a file and saveing the filenames into variables for further processing:
# file split before ftp and put result filenames into variables
if ]; then
awk '{close(f);f=$1}{sub("^","");print > f".TXT"}' $_ftpfile
set B*.TXT... (0 Replies)
Discussion started by: spidermike
0 Replies
4. Shell Programming and Scripting
Hi,
I have a data file xyz.dat similar to the one given below,
2345|98|809||x|969|0
2345|98|809||y|0|537
2345|97|809||x|544|0
2345|97|809||y|0|651
9685|98|809||x|321|0
9685|98|809||y|0|357
9685|98|709||x|687|0
9685|98|709||y|0|234
2315|98|809||x|564|0
2315|98|809||y|0|537... (2 Replies)
Discussion started by: nithins007
2 Replies
5. Shell Programming and Scripting
Hi all,
I'm pretty new to Shell scripting and I need some help to split a source text file into multiple files. The source has a row with pattern where the file needs to be split, and the pattern row also contains the file name of the destination for that specific piece. Here is an example:
... (2 Replies)
Discussion started by: cul8er
2 Replies
6. Shell Programming and Scripting
Hi ,
I do have a fixedwidth flatfile that has data for 10 different datasets each identified by the first two digits in the flatfile.
01 in the first two digit position refers to Set A
02 in the first two digit position refers to Set B and so on
I want to genrate 10 different files from my... (6 Replies)
Discussion started by: okkadu
6 Replies
7. Shell Programming and Scripting
Hello;
I have a file consists of 4 columns separated by tab. The problem is the third fields. Some of the them are very long but can be split by the vertical bar "|". Also some of them do not contain the string "UniProt", but I could ignore it at this moment, and sort the file afterwards. Here is... (5 Replies)
Discussion started by: yifangt
5 Replies
8. Shell Programming and Scripting
I need to split a file if it is over 2GB in size (or any size), preferably split on the lines. I have figured out how to get the file size using awk, and I can split the file based on the number of lines (which I got with wc -l) but I can't figure out how to connect them together in the script.
... (6 Replies)
Discussion started by: ssemple2000
6 Replies
9. Shell Programming and Scripting
Good day all
I need some helps,
say that I have data like below, each field separated by a tab
DATE NAME ADDRESS
15/7/2012 LX a.b.c
15/7/2012 LX1 a.b.c
16/7/2012 AB a.b.c
16/7/2012 AB2 a.b.c
15/7/2012 LX2 a.b.c... (2 Replies)
Discussion started by: alexyyw
2 Replies
10. UNIX for Beginners Questions & Answers
Dear Users,
Appreciate your help if you could help me with splitting a large file > 1 million lines with sed or awk. below is the text in the file
input file.txt
scaffold1 928 929 C/T +
scaffold1 942 943 G/C +
scaffold1 959 960 C/T +... (6 Replies)
Discussion started by: kapr0001
6 Replies
FORK(2) System Calls Manual FORK(2)
NAME
fork - create a new process
SYNOPSIS
pid = fork()
int pid;
DESCRIPTION
Fork causes creation of a new process. The new process (child process) is an exact copy of the calling process except for the following:
The child process has a unique process ID.
The child process has a different parent process ID (i.e., the process ID of the parent process).
The child process has its own copy of the parent's descriptors. These descriptors reference the same underlying objects, so that, for
instance, file pointers in file objects are shared between the child and the parent, so that an lseek(2) on a descriptor in the child
process can affect a subsequent read or write by the parent. This descriptor copying is also used by the shell to establish standard
input and output for newly created processes as well as to set up pipes.
The child processes resource utilizations are set to 0; see setrlimit(2).
RETURN VALUE
Upon successful completion, fork returns a value of 0 to the child process and returns the process ID of the child process to the parent
process. Otherwise, a value of -1 is returned to the parent process, no child process is created, and the global variable errno is set to
indicate the error.
ERRORS
Fork will fail and no child process will be created if one or more of the following are true:
[EAGAIN] The system-imposed limit on the total number of processes under execution would be exceeded. This limit is configuration-
dependent.
[EAGAIN] The system-imposed limit MAXUPRC (<sys/param.h>) on the total number of processes under execution by a single user would be
exceeded.
[ENOMEM] There is insufficient swap space for the new process.
SEE ALSO
execve(2), wait(2)
3rd Berkeley Distribution May 22, 1986 FORK(2)