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.
So the command
gives me the file listing in a file, and the command
gives me a list of all the files that are larger that the size with their sizes, and the command
gives me the number of lines in the file (call it 50000), and if I manually put them together, the command
gives me two files, myfile.txtaa and myfile.txtab, each with 25000 lines.
The problem is how to get them together in one script....
Thank you.
I have the file with the records like
4234234 US phone
3244234 US cup
2342342 CA phone
8947234 US phone
2389472 CA cup
2348972 US maps
3894234 CA phone
I want the records with (US,phone) as record to be in one file, (Us, cup) in another file and (CA,cup) to be in another
I mean all... (12 Replies)
this is my issue.
4 parameters are passed from korn shell to sql script.
parameter_1= varchar2 datatype or no value entered my user.
parameter_2= number datatype or no value entered my user.
parameter_3= number datatype or no value entered my user.
parameter_4= number datatype or no... (5 Replies)
Hi Friends,
Below is my requirement. I have a file with the below structure.
0001A1....
0001B1..
....
0001L1
0002A1
0002B1
......
0002L1
..
the first 4 characters are the sequence numbers for a record, A record will start with A1 and end with L1 with same sequence number. Now the... (2 Replies)
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)
Hello, I have a large file (2GB) that I would like to split based on pattern and size.
I've used the following command to split the file (token is "HELLO")
awk '/HELLO/{i++}{print > "file"i}' input.txt
and the output is similar to the following (i included filesize in KB):
10 ... (2 Replies)
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)
So I have a space delimited file that I'd like to split into multiple files based on multiple column values.
This is what my data looks like
1bc9A02 1 10 1000 FTDLNLVQALRQFLWSFRLPGEAQKIDRMMEAFAQRYCQCNNGVFQSTDTCYVLSFAIIMLNTSLHNPNVKDKPTVERFIAMNRGINDGGDLPEELLRNLYESIKNEPFKIPELEHHHHHH
1ku1A02 1 10... (9 Replies)
I have a file that is about 7 GB in size. The requirement is I should split the file equally in such a way that the size of the split files is less than 2Gb. If the file is less than 2gb, than nothing needs to be done. ( need to done using shell script)
Thanks, (4 Replies)
i have two files , one is var.txt and another res.dat file
var.txt contains informaton like below
date,request,sales,item
20171015,1,123456,216
20171015,1,123456,217
20171015,2,345678,214
20171015,3,456789,218
and res.dat contains is a one huge file contains information like... (1 Reply)
Hi,
I have a directory in Unix and there are folders available in the directory.
Files are created on different month and now i have a requirement to calculate size of the folder on month basis.
Is there any Unix command to check this please??
Thanks (6 Replies)
Discussion started by: Nivas
6 Replies
LEARN ABOUT SUNOS
split
split(1) User Commands split(1)NAME
split - split a file into pieces
SYNOPSIS
split [-linecount | -l linecount] [-a suffixlength] [ file [name]]
split [ -b n | nk | nm] [-a suffixlength] [ file [name]]
DESCRIPTION
The split utility reads file and writes it in linecount-line pieces into a set of output-files. The name of the first output-file is name
with aa appended, and so on lexicographically, up to zz (a maximum of 676 files). The maximum length of name is 2 characters less than the
maximum filename length allowed by the filesystem. See statvfs(2). If no output name is given, x is used as the default (output-files will
be called xaa, xab, and so forth).
OPTIONS
The following options are supported:
-linecount | -l linecounNumber of lines in each piece. Defaults to 1000 lines.
-a suffixlength Uses suffixlength letters to form the suffix portion of the filenames of the split file. If -a is not specified,
the default suffix length is 2. If the sum of the name operand and the suffixlength option-argument would create a
filename exceeding NAME_MAX bytes, an error will result; split will exit with a diagnostic message and no files
will be created.
-b n Splits a file into pieces n bytes in size.
-b nk Splits a file into pieces n*1024 bytes in size.
-b nm Splits a file into pieces n*1048576 bytes in size.
OPERANDS
The following operands are supported:
file The path name of the ordinary file to be split. If no input file is given or file is -, the standard input will be used.
name The prefix to be used for each of the files resulting from the split operation. If no name argument is given, x will be used as
the prefix of the output files. The combined length of the basename of prefix and suffixlength cannot exceed NAME_MAX bytes. See
OPTIONS.
USAGE
See largefile(5) for the description of the behavior of split when encountering files greater than or equal to 2 Gbyte ( 2**31 bytes).
ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of split: LANG, LC_ALL, LC_CTYPE, LC_MES-
SAGES, and NLSPATH.
EXIT STATUS
The following exit values are returned:
0 Successful completion.
>0 An error occurred.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWesu |
+-----------------------------+-----------------------------+
|CSI |enabled |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
SEE ALSO csplit(1), statvfs(2), attributes(5), environ(5), largefile(5), standards(5)SunOS 5.10 16 Apr 1999 split(1)