Sponsored Content
Top Forums Shell Programming and Scripting Split file into multiple files using awk Post 302987226 by RudiC on Wednesday 7th of December 2016 06:59:51 AM
Old 12-07-2016
Welcome to the forum.

This is a widespread problem. Ans attempts/ideas/thoughts from your side? Did you search these fora and/or look into the related threads at the bottom of this page, trying to adapt the solutions given?

What is "number of lines in file-" and "number of lines in file-2" ?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Split a file into multiple files

I have a file ehich has multiple create statements as create abc 123 one two create xyz 456 four five create nnn 666 six four I want to separte each create statement in seperate files (3 Replies)
Discussion started by: glamo_2312
3 Replies

2. UNIX for Dummies Questions & Answers

split a file into multiple files

Hi All, I have a file ABC.txt and I need to split this file on every 250 rows. And the file name should be ABC1.txt , ABC2.txt and so on. I tried with split command split -l 250 <filename> '<filename>' but the file name returned was ABC.txtaa ABC.txtab. Please... (8 Replies)
Discussion started by: kumar66
8 Replies

3. Shell Programming and Scripting

Split a file into multiple files

Hi, i have a file like this: 1|2|3|4|5| 1|2|8|4|6| Trailer1||||| 1|2|3| Trailer2||| 3|4|5|6| 3|4|5|7| 3|4|5|8| Trailer2||| I want to generate 3 files out of this based on the trailer record. Trailer record string can be different for each file or it may be same for one or two. No... (24 Replies)
Discussion started by: pparthji
24 Replies

4. Shell Programming and Scripting

Split line to multiple files Awk/Sed/Shell Script help

Hi, I need help to split lines from a file into multiple files. my input look like this: 13 23 45 45 6 7 33 44 55 66 7 13 34 5 6 7 87 45 7 8 8 9 13 44 55 66 77 8 44 66 88 99 6 I want to split every 3 lines from this file to be written to individual files. (3 Replies)
Discussion started by: saint2006
3 Replies

5. Shell Programming and Scripting

Split file into multiple files

Hi I have a file that has multiple sequences; the sequence name is the line starting with '>'. It looks like below: infile.txt: >HE_ER tttggtgccttgactcggattgggggacctcccttgggagatcaatcccctgtcctcctgctctttgctc cgtgaaaaggatccacctatgacctctagtcctcagacccaccagcccaaggaacatctcaccaatttca >M7B_Ho_sap... (2 Replies)
Discussion started by: jdhahbi
2 Replies

6. Shell Programming and Scripting

split file into multiple files

Hi, I have a file of the following syntax that has around 120K records that are tab separated. input.txt abc def klm 20 76 . + . klm_mango unix_00000001; abc def klm 83 84 . + . klm_mango unix_0000103; abc def klm 415 439 . + . klm_mango unix_00001043; I am looking for an awk oneliner... (2 Replies)
Discussion started by: jacobs.smith
2 Replies

7. Shell Programming and Scripting

How to split file into multiple files using awk based on 1 field in the file?

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

8. Shell Programming and Scripting

awk script to split file into multiple files based on many columns

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)
Discussion started by: viored
9 Replies

9. Shell Programming and Scripting

Split a big file into multiple files using awk

this thread is a continuation from previous thread https://www.unix.com/shell-programming-and-scripting/223901-split-big-file-into-multiple-files-based-first-four-characters.html ..I am using awk to split file and I have a syntax error while executing the below code I am using AIX 7.2... (4 Replies)
Discussion started by: etldev
4 Replies

10. Shell Programming and Scripting

awk to split file using multiple deliminators

I am trying to use awk to split a input file using multiple delimiters :-|. The input file is just one field and the output is 6 tab-delimited fields. The awk below does run and works as expected until I add the third delimiter |, which gives the current output below. I am not sure what is... (6 Replies)
Discussion started by: cmccabe
6 Replies
sdiff(1)						      General Commands Manual							  sdiff(1)

NAME
sdiff - Compares two files and displays the differences in a side-by-side format SYNOPSIS
sdiff [-l | -s] [-w number] [-o output_file] file1 file2 The sdiff command reads file1 and file2, uses diff to compare them, and writes the results to standard output in a side-by-side format. OPTIONS
Displays only the left side when lines are identical. Creates a third file, output_file, by a controlled interactive line-by-line merging of file1 and file2. The following subcommands govern the creation of this file: Adds the left side to output_file. Adds the right side to output_file. Stops displaying identical lines. Begins displaying identical lines. Enters ed with the left side, the right side, both sides, or an empty file, respectively. Each time you exit from ed, sdiff writes the resulting edited file to the end of output_file. If you fail to save the changes before exiting, sdiff writes the initial input to output_file. Exits the interactive session. Suppresses display of identical lines. Sets the width of the output line to number (130 characters by default). DESCRIPTION
The sdiff command displays each line of the two files with a series of spaces between them if the lines are identical, a < (left angle bracket) in the field of spaces if the line only exists in file1, a > (right angle bracket) if the line only exists in file2, and a | (ver- tical bar) for lines that are different. When you specify the -o option, sdiff produces a third file by merging file1 and file2 according to your instructions. Note that the sdiff command invokes the diff -b command to compare two input files. The -b option causes the diff command to ignore trail- ing spaces, tab characters, and consider other strings of spaces as equal. EXAMPLES
To print a comparison of two files, enter: sdiff chap1.bak chap1 This displays a side-by-side listing that compares each line of chap1.bak and chap1. To display only the lines that differ, enter: sdiff -s -w 80 chap1.bak chap1 This displays the differences at the tty. The -w 80 sets page width to 80 columns. The -s option tells sdiff not to display lines that are identical in both files. To selectively combine parts of two files, enter: sdiff -s -w 80 -o chap1.combo chap1.bak chap1 This combines chap1.bak and chap1 into a new file called chap1.combo. For each group of differing lines, sdiff asks you which group to keep or whether you want to edit them using ed. SEE ALSO
Commands: diff(1), ed(1) sdiff(1)
All times are GMT -4. The time now is 06:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy