Sponsored Content
Top Forums Shell Programming and Scripting Help with merging 2 files into 1 Post 302437295 by lordsmiter on Wednesday 14th of July 2010 02:13:21 PM
Old 07-14-2010
Wow that works great. Looks like I need to read up some more on nawk.

One thing though. This is eliminating the rows from FileA that have the same A3 value but the unique A1. In other words, the merged file should contain 1 row for every A1 field that contains an A3 (no matter if its the same as the one above it). This is eliminating the first 2 lines that have a "DDDD" in FileA. There needs to be 3 lines that have a "DDDD" in the merged output since FileA had 3 different A1's with the same A3. "HHHH" is the same way.

How would you alter this to allow those scenarios to be caught?


:::::::::
::FileA::
:::::::::
A1-------A2--------A3---A4---A5--
=================================
DC35S51--XXXXY1----DDDD------44X-
DC35S52--XXXXY2----DDDD------44Y-
DC35S53--XXXXY3----DDDD------44Z-
=================================

:::::::::
::FileB::
:::::::::
B1------B2-------------------B3--------B4--------B5----------
=============================================================
DDDD----+NDMMN.BMXXMNX-------27/98B----NX/778----93010-------
=============================================================

It should come out to this:

:::::::::::::::
::Merged File::
:::::::::::::::
A1--------A3----B2----------------B3------B4------B5------
==========================================================
DC35S51---DDDD--+NDMMN.BMXXMNX----27/98B--NX/778--93010---
DC35S52---DDDD--+NDMMN.BMXXMNX----27/98B--NX/778--93010---
DC35S53---DDDD--+NDMMN.BMXXMNX----27/98B--NX/778--93010---
==========================================================

But instead its coming out like this:

A1--------A3----B2----------------B3------B4------B5------
==========================================================
DC35S53---DDDD--+NDMMN.BMXXMNX----27/98B--NX/778--93010---
==========================================================


eliminating the DC35S51 & DC35S52.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

merging files

Thanks in advance I have 2 files having key field in each.I would like to join both on common key.I have used join but not sucessful. The files are attached here . what i Want in the output is on the key field SLS OFFR . I have used join commd but not successful. File one ======= SNO ... (6 Replies)
Discussion started by: vakharia Mahesh
6 Replies

2. Shell Programming and Scripting

Merging 2 files

Hi, I have got two files 1.txt 1111|apple| 2222|orange| 2.txt 1111|1234|000000000004356| 1111|1234|000000001111| 1111|1234|002000011112| 2222|5678|000000002222| 2222|9102|000000002222| I need to merge these two so that my out put looks like below: Search code being used should be... (4 Replies)
Discussion started by: jisha
4 Replies

3. Shell Programming and Scripting

Help with merging files

i would like to merge two files that have the same format but have different data. i would like to create one output file that contains information from both the original files.:rolleyes: (2 Replies)
Discussion started by: joe black
2 Replies

4. Shell Programming and Scripting

merging two files

Hi everyone, I have two files which will be exactly same at first. After sometime there will be inserts in one file. My problem is how to reflect these changes in second file also. I found out that any compare and merge utility would do the job like, GNU " sdiff " command. But the... (14 Replies)
Discussion started by: rameshonline
14 Replies

5. Shell Programming and Scripting

merging of files.

Hi, I want to merge the two files on the basis of columns like... file 1 Data Key A 12 B 13 file2 Data Value A A1 A A2 B B1 B B2 (5 Replies)
Discussion started by: clx
5 Replies

6. UNIX for Dummies Questions & Answers

Merging two files

Hi, I have two files a.txt and b.txt. a.txt 1 2 3 4 b.txt a b c d e I want to generate a file c.txt by merging these two file and the resultant file would contain c.txt 1 (4 Replies)
Discussion started by: siba.s.nayak
4 Replies

7. Shell Programming and Scripting

Merging files

I have two files file 1 containing x rows and 1 column file 2 containing x rows and 1 column I want to merge both the files and add a comma between the two eg plz guide (1 Reply)
Discussion started by: test_user
1 Replies

8. Shell Programming and Scripting

Merging two files with same name

Hello all, I have limited experience in shell scripting. Here goes my question: I have two directories that have same number of files with same file names i.e. consider 2 directories A and B. Both directories have files 1.txt, 2.txt...... I need to merge the file 1.txt of A with file 1.txt... (5 Replies)
Discussion started by: jaysean
5 Replies

9. Shell Programming and Scripting

Merging two files

Guys, I am having little problem with getting a daily report! The daily process that I do is as follows 1. Unload Header for the report from the systables to one unl file, say Header.unl 2. Unload the data from the required table/tables to another unl file, say Data.unl 3. Send a... (2 Replies)
Discussion started by: PikK45
2 Replies

10. Shell Programming and Scripting

Merging two files

Hi All , I have a scenario where we need to combine two files . Below are the sample files and expected output , File 1: 1|ab 1|ac 1|ae 2|ad 2|ac File 2: 1|xy 1|fc 2|gh 2|ku Output file : 1|ab|xy (3 Replies)
Discussion started by: saj
3 Replies
BLOCKDIAG(1)						      General Commands Manual						      BLOCKDIAG(1)

NAME
blockdiag - generate block-diagram image file from spec-text file. SYNOPSIS
blockdiag [options] file DESCRIPTION
This manual page documents briefly the blockdiag commands. blockdiag is a program that generate block-diagram image file from spec-text file. OPTIONS
These programs follow the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below. For a complete description, see the SEE ALSO. --version show program's version number and exit -h, --help Show summary of options -a, --antialias Pass diagram image to anti-alias filter -c FILE, --config=FILE read configurations from FILE -o FILE write diagram to FILE -f FONT, --font=FONT use FONT to draw diagram --fontmap=FONT use FONTMAP file to draw diagram -s, --separate Separate diagram images for each group -T TYPE Output diagram as TYPE format --nodoctype Do not output doctype definition tags (SVG only) --no-transparency do not make transparent background of diagram (PNG only) SEE ALSO
The programs are documented fully by http://tk0miya.bitbucket.org/blockdiag/build/html/index.html AUTHOR
blockdiag was written by Takeshi Komiya <i.tkomiya@gmail.com> This manual page was written by Kouhei Maeda <mkouhei@palmtb.net>, for the Debian project (and may be used by others). May 9, 2011 BLOCKDIAG(1)
All times are GMT -4. The time now is 01:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy