Sponsored Content
Top Forums Shell Programming and Scripting split a csv file into specified number of files (not lines) Post 302569126 by 7stars on Saturday 29th of October 2011 04:18:38 PM
Old 10-29-2011
Quote:
Originally Posted by bartus11
So you want to split the file into 15 even parts? And put those parts into separate files?
yes, 15 parts or every number of parts i wanna choose... .. .
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

split a file into a specified number of files

I have been googling on the 'split' unix command to see if it can split a large file into 'n' number of files. Can anyone spare an example or a code snippet? Thanks, - CB (2 Replies)
Discussion started by: ChicagoBlues
2 Replies

2. Shell Programming and Scripting

Scripting help: Split a file into equal number of lines.

Experts, I have a file datafile.txt that consists of 1732 Line, I want to split the file into equal number of lines with 10 file. (The last file can have 2 line extra to match 1732) Please advise how to do that, Thanks in advance.. (2 Replies)
Discussion started by: rveri
2 Replies

3. Shell Programming and Scripting

Split single file into multiple files based on the number in the column

Dear All, I would like to split a file of the following format into multiple files based on the number in the 6th column (numbers 1, 2, 3...): ATOM 1 N GLY A 1 -3.198 27.537 -5.958 1.00 0.00 N ATOM 2 CA GLY A 1 -2.199 28.399 -6.617 1.00 0.00 ... (3 Replies)
Discussion started by: tomasl
3 Replies

4. Shell Programming and Scripting

Script to split files based on number of lines

I am getting a few gzip files into a folder by doing ftp to another server. Once I get them I move them to another location .But before that I need to make sure each gzip is not more than 5000 lines and split it up . The files I get are anywhere from 500 lines to 10000 lines in them and is in gzip... (4 Replies)
Discussion started by: gubbu
4 Replies

5. Shell Programming and Scripting

Split the single file lines into multiple files

Let's assume that I have a file name called ‘A' and it has 100 lines in it and would like to split these 100 lines into 4 files as specified bellow. INPUT: Input file name A 1 2 3 4 5 6 7 8 9 ........100 Output: 4 output files (x,y,z,w) File x should contains (Skip 4 lines)... (15 Replies)
Discussion started by: subbarao25
15 Replies

6. UNIX for Dummies Questions & Answers

Split single file into n number of files

Hi, I am new to unix. we have a requirement here to split a single file into multiples files based on the number of people available for processing. So i tried my hand at writing some code as below. #!/bin/bash var1=`wc -l $filename` var2=$var1/$splitno split -l $var2 $1 Please help me... (6 Replies)
Discussion started by: quirkguy
6 Replies

7. UNIX for Dummies Questions & Answers

Command to split the files based on the number of lines in it

Hello Friends, Can anyone help me for the below requirement. I am having a file called Input.txt. My requirement is first check the count that is wc -l input.txt If the result of the wc -l Input.txt is less than 10 then don't split the Input.txt file. Where as if Input.txt >= 10 the split... (12 Replies)
Discussion started by: malaya kumar
12 Replies

8. Shell Programming and Scripting

Split a .csv File into Multiple Files

Hi guys, I have a requirement where i need to split a .csv file into multiple files. Say for example i have data.csv file and i have splitted that into multiple files based on some conditions i.e first file should have 100, last file 50 and other files 1000 each. Am passing the values in... (2 Replies)
Discussion started by: azherkn3
2 Replies

9. UNIX for Dummies Questions & Answers

Split file based on number of blank lines

Hello All , I have a file which needs to split based on the blank lines Name ABC Address London Age 32 (4 blank new line) Name DEF Address London Age 30 (4 blank new line) Name DEF Address London (8 Replies)
Discussion started by: Pratik4891
8 Replies

10. UNIX for Beginners Questions & Answers

Split file into multiple files based on empty lines

I am using below code to split files based on blank lines but it does not work. awk 'BEGIN{i=0}{RS="";}{x="F"++i;}{print > x;}' Your help would be highly appreciated find attachment of sample.txt file (2 Replies)
Discussion started by: imranrasheedamu
2 Replies
dpkg-split(1)							  dpkg utilities						     dpkg-split(1)

NAME
dpkg-split - Debian package archive split/join tool SYNOPSIS
dpkg-split [options] command DESCRIPTION
dpkg-split splits Debian binary package files into smaller parts and reassembles them again, to support the storage of large package files on small media such as floppy disks. It can be operated manually using the --split, --join and --info options. It also has an automatic mode, invoked using the --auto option, where it maintains a queue of parts seen but not yet reassembled and reassembles a package file when it has seen all of its parts. The --listq and --discard options allow the management of the queue. All splitting, joining and queueing operations produce informative messages on standard output; these may safely be ignored. COMMANDS
-s, --split complete-archive [prefix] Splits a single Debian binary package into several parts. The parts are named prefix.NofM.deb where N is the part number, starting at 1, and M is the total number of parts (both in decimal). If no prefix is supplied then the complete-archive filename is taken, including directory, with any trailing .deb removed. -j, --join part... Joins the parts of a package file together, reassembling the original file as it was before it was split. The part files given as arguments must be all the parts of exactly the same original binary file. Each part must occur exactly once in the argument list, though the parts to not need to be listed in order. The parts must of course all have been generated with the same part size specified at split time, which means that they must usually have been generated by the same invocation of dpkg-split --split. The parts' filenames are not significant for the reassembly process. By default the output file is called package-version.deb. -I, --info part... Prints information, in a human-readable format, about the part file(s) specified. Arguments which are not binary package parts pro- duce a message saying so instead (but still on standard output). -a, --auto -o complete-output part Automatically queue parts and reassemble a package if possible. The part specified is examined, and compared with other parts of the same package (if any) in the queue of packages file parts. If all parts of the package file of which part is a part are available then the package is reassembled and written to complete-out- put (which should not usually already exist, though this is not an error). If not then the part is copied into the queue and complete-output is not created. If part is not a split binary package part then dpkg-split will exit with status 1; if some other trouble occurs then it will exit with status 2. The --output or -o option must be supplied when using --auto. (If this were not mandatory the calling program would not know what output file to expect.) -l, --listq Lists the contents of the queue of packages to be reassembled. For each package file of which parts are in the queue the output gives the name of the package, the parts in the queue, and the total number of bytes stored in the queue. -d, --discard [package...] This discards parts from the queue of those waiting for the remaining parts of their packages. If no package is specified then the queue is cleared completely; if any are specified then only parts of the relevant package(s) are deleted. -h, --help Show the usage message and exit. --version Show the version and exit. OPTIONS
--depotdir directory Specifies an alternative directory for the queue of parts awaiting automatic reassembly. The default is /var/lib/dpkg. -S, --partsize kibibytes Specifies the maximum part size when splitting, in kibibytes (1024 bytes). The default is 450 KiB. -o, --output complete-output Specifies the output file name for a reassembly. This overrides the default for a manual reassembly (--join) and is mandatory for an automatic queue-or-reassemble (--auto). -Q, --npquiet When doing automatic queue-or-reassembly dpkg-split usually prints a message if it is given a part that is not a binary package part. This option suppresses this message, to allow programs such as dpkg to cope with both split and unsplit packages without pro- ducing spurious messages. --msdos Forces the output filenames generated by --split to be msdos-compatible. This mangles the prefix - either the default derived from the input filename or the one supplied as an argument: alphanumerics are lowercased, plus signs are replaced by x's and all other characters are discarded. The result is then truncated as much as is necessary, and filenames of the form prefixNofM.deb are generated. EXIT STATUS
An exit status of 0 indicates that the requested split, merge, or other command succeeded. --info commands count as successful even if the files are not binary package parts. An exit status of 1 occurs only with --auto and indicates that the part file was not a binary package part. An exit status of 2 indicates some kind of trouble, such as a system call failure, a file that looked like a package part file but was cor- rupted, a usage error or some other problem. BUGS
dpkg-split uses some rather out-of-date conventions for the the filenames of Debian packages. Full details of the packages in the queue are impossible to get without digging into the queue directory yourself. There is no easy way to test whether a file that may be a binary package part is one. The architecture is not represented in the part files' header, only in the control information of the contained binary package file, and it is not present in the filenames generated. FILES
/var/lib/dpkg/parts The default queue directory for part files awaiting automatic reassembly. The filenames used in this directory are in a format internal to dpkg-split and are unlikely to be useful to other programs, and in any case the filename format should not be relied upon. SEE ALSO
deb(5), deb-control(5), dpkg-deb(1), dpkg(1). AUTHOR
Copyright (C) 1995-1996 Ian Jackson This is free software; see the GNU General Public Licence version 2 or later for copying conditions. There is NO WARRANTY. Debian Project 2009-06-26 dpkg-split(1)
All times are GMT -4. The time now is 09:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy