Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Split Command Generating Incomplete Output Files Post 303000625 by Ariean on Sunday 16th of July 2017 10:39:59 AM
Old 07-16-2017
Split Command Generating Incomplete Output Files

Hello All,
May i please know how do i ensure my split command would NOT generate incomplete output files like below, the last lines in each file is missing some columns or last line is complete.

Code:
split -b 50GB File File_

Code:
File_aa

|551|70210203|xxxxxxx|12/22/2010 20:44:58|11/01/2010 00:00:00||||||||1.0000000000||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||AD7678||||||||||||||||||||||||||||||||||xxxxxx||||||5034||e4mdevl1|07/14/2017 15:48:02||
|551|70220223|xxxxxxx|12/22/2010 20:44:58|11/01/2010 00:00:00||||||||1.0000000000||||||||||||

File_ab

|562|71654982|xxxxxx|11/22/2011 19:01:45|10/01/2011 00:00:00||||||||1.0000000000||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||AH6734||||||||||||||||||||||||||||||||||3xxxx||||||5034||e4mdevl1|07/14/2017 15:48:02||
|562|71655059|171348415

File_ac

|573|57162801|xxxxxx|10/24/2012 15:22:12|09/01/2012 00:00:00||||||||0.9965540000||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||AB0496||||||||||||||||||||||||||||||||||xxxxx||||||5034||e4mdevl1|07/14/2017 15:48:02||
|573|57162908|4004900159|10/

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk command to split in to 2 files

Hi, I have a problem in grepping a file for 2 strings and writing them to 2 appropriate files. I need to use the awk command and read the file only once and write to the appropriate file. My file is very huge in size and it is taking a long time using cat command and grep command. Can anyone... (3 Replies)
Discussion started by: m_subra_mani
3 Replies

2. Shell Programming and Scripting

Join of files is incomplete?!

Hi folks, I am using the join command to join two files on a common field as follows: File1.txt Adsorption|H01.181.529.047 Adult|M01.060.116 Children|M01.055 File2.txt 5|Adsorption|C0001674 7|Adult|C000001 6|Children|C00002 join -i -t "|" -a 2 -1 1 -2 2 File1.txt File2.txt This... (7 Replies)
Discussion started by: s0460205
7 Replies

3. Shell Programming and Scripting

How to ignore incomplete files

On Solaris & AIX, suppose there is a directory 'dir'. Log files of size approx 1MB are continuously being deposited here by scp command. I have a script that scans this dir every 5 mins and moves away the log files that have been deposited so far. How do I design my script so that I pick up... (6 Replies)
Discussion started by: sentak
6 Replies

4. Solaris

How to ignore incomplete files

On Solaris, suppose there is a directory 'dir'. Log files of size approx 1MB are continuously being deposited here by scp command. I have a script that scans this dir every 5 mins and moves away the log files that have been deposited so far. How do I design my script so that I pick up *only*... (6 Replies)
Discussion started by: sentak
6 Replies

5. UNIX for Dummies Questions & Answers

split files into specified number of output files

Hi everyone, I have some large text files that I need to split into a specific number of files of equal size. As far as I know (and I don't really know that much :)) the split command only lets you specify the number of lines or bytes. The files are all of a different size, so the number of... (4 Replies)
Discussion started by: Migrainegirl
4 Replies

6. Shell Programming and Scripting

need help generating this output

need to check hardware error are zero iostat -en |awk '{ if ( $2 == 0 ) { print " " } else { print " Hardware errors "} } can someone please tell me whats wrong with this ---------- Post updated at 10:19 PM ---------- Previous update was at 10:16 PM ---------- iostat -en ----... (11 Replies)
Discussion started by: arch12
11 Replies

7. Shell Programming and Scripting

renaming the default output name of the split command

Hello, I would like to split a file but I dont what the subfiles to be named the way they are: ex: default name: xaa xab xac xad xae desired name: b01 b02 b03 b04 b05 I know I can rename them afterwards however I have a varialbe split lenghth, in other words I am not sure how... (2 Replies)
Discussion started by: smarones
2 Replies

8. Shell Programming and Scripting

adding file extensions to split output files

Hello, I've searched this forum and others for a solution to my problem but nothing seems just right, I'm hoping I can get some help (seems like this should be easy, and I apologize if I've missed something on the forum): I have several large .fastq DNA sequence files (~20million reads,... (2 Replies)
Discussion started by: ljk
2 Replies

9. Shell Programming and Scripting

Split: File into multiple and keeping the same 3 lines from input into all output files

The following code will split the infile into multiple files. However, I need it to insert the same first 3 lines from the original input file into each splitted file. How do I modify my script below to do so: print -n "Enter file name to split? " ; read infile if then echo "Invalid file... (4 Replies)
Discussion started by: mrn6430
4 Replies

10. Shell Programming and Scripting

Randomly selecting sequences and generating specific output files

I have two files containing hundreds of different sequences with the same Identifiers (ID-001, ID-002, etc.,), something like this: Infile1: ID-001 ATGGGAGCGGGGGCGTCTGCCTTGAGGGGAGAGAAGCTAGATACA ID-002 ATGGGAGCGGGGGCGTCTGTTTTGAGGGGAGAGAAGCTAGATACA ID-003... (18 Replies)
Discussion started by: Xterra
18 Replies
CSPLIT(1)						    BSD General Commands Manual 						 CSPLIT(1)

NAME
csplit -- split files based on context SYNOPSIS
csplit [-ks] [-f prefix] [-n number] file args ... DESCRIPTION
The csplit utility splits file into pieces using the patterns args. If file is a dash ('-'), csplit reads from standard input. The options are as follows: -f prefix Give created files names beginning with prefix. The default is ``xx''. -k Do not remove output files if an error occurs or a HUP, INT or TERM signal is received. -n number Use number of decimal digits after the prefix to form the file name. The default is 2. -s Do not write the size of each output file to standard output as it is created. The args operands may be a combination of the following patterns: /regexp/[[+|-]offset] Create a file containing the input from the current line to (but not including) the next line matching the given basic regular expression. An optional offset from the line that matched may be specified. %regexp%[[+|-]offset] Same as above but a file is not created for the output. line_no Create containing the input from the current line to (but not including) the specified line number. {num} Repeat the previous pattern the specified number of times. If it follows a line number pattern, a new file will be created for each line_no lines, num times. The first line of the file is line number 1 for historic reasons. After all the patterns have been processed, the remaining input data (if there is any) will be written to a new file. Requesting to split at a line before the current line number or past the end of the file will result in an error. ENVIRONMENT
The LANG, LC_ALL, LC_COLLATE and LC_CTYPE environment variables affect the execution of csplit as described in environ(7). EXIT STATUS
The csplit utility exits 0 on success, and >0 if an error occurs. EXAMPLES
Split the mdoc(7) file foo.1 into one file for each section (up to 20): csplit -k foo.1 '%^.Sh%' '/^.Sh/' '{20}' Split standard input after the first 99 lines and every 100 lines thereafter: csplit -k - 100 '{19}' SEE ALSO
sed(1), split(1), re_format(7) STANDARDS
The csplit utility conforms to IEEE Std 1003.1-2001 (``POSIX.1''). HISTORY
A csplit command appeared in PWB UNIX. BUGS
Input lines are limited to LINE_MAX (2048) bytes in length. BSD
January 26, 2005 BSD
All times are GMT -4. The time now is 06:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy