Sponsored Content
Full Discussion: Merge column file
Top Forums Shell Programming and Scripting Merge column file Post 302931563 by Don Cragun on Tuesday 13th of January 2015 10:09:35 PM
Old 01-13-2015
Quote:
Originally Posted by aav1307
Very fine

Thanks you

---------- Post updated at 07:20 AM ---------- Previous update was at 05:49 AM ----------

Thaks so much Don Cragun,

Just like this, excelent, one finally question, how I can generality you code for many colums so,

... ... ...
Did you try changing $1 in both places in my script to $0 as I suggested in my post with that script if you wanted to preserve spaces in your input files?

If that didn't work, please show us the output my script produced after that change (in CODE tags) and clearly specify what needs to be done differently.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Column Merge?

Hi all, I need to join two columns from two different files file1.txt and file2.txt and append in a new file. Example : $cat file1.txt ABCD.ksh:010141 ABCD.ksh:010511 ABCD.ksh:010815 ABCD.ksh:011114 ABCD.ksh:011415 ABCD.ksh:011720 ABCD.ksh:012022 ABCD.ksh:012830 ABCD.ksh:014432... (5 Replies)
Discussion started by: sabyasm
5 Replies

2. Shell Programming and Scripting

Merge Two Files based on First column

Hi, I need to join two files based on first column of both files.If first column of first file matches with the first column of second file, then the lines should be merged together and go for next line to check. It is something like: File one: 110001 abc efd 110002 fgh dfg 110003 ... (10 Replies)
Discussion started by: apjneeraj
10 Replies

3. Shell Programming and Scripting

merge two two txt files into one file based on one column

Hi, I have file1.txt and file2.txt and would like to create file3.txt based on one column in UNIX Eg: file1.txt 17328756,0000786623.pdf,0000786623 20115537,0000793892.pdf,0000793892 file2.txt 12521_74_4.zip,0000786623.pdf 12521_15_5.zip,0000793892.pdf Desired Output ... (5 Replies)
Discussion started by: techmoris
5 Replies

4. Shell Programming and Scripting

Help with merge two file based on similar column content

Input file 1: A1BG A1BG A1BG A1CF A1CF BCAS BCAS A2LD1 A2M A2M HAT . . Input file 2: A1BG All A1CF TEMP (5 Replies)
Discussion started by: perl_beginner
5 Replies

5. Shell Programming and Scripting

Merge CSV files and create a column with the filename from the original file

Hello everyone!! I am not completely new to shell script but I havent been able to find the answer to my problem and I'm sure there are some smart brains here up for the challenge :D. I have several CSV files that I need to combine into one, but I also need to know where each row came from.... (7 Replies)
Discussion started by: fransanchezoria
7 Replies

6. Shell Programming and Scripting

column merge same value

Dear All, I have the following file: file1 "1" 189218400 189221399 3000 "0041 ENSMUSG00000000031" "0041" "+" "ENSMUSG00000000031" 189039418 189175306 "downstream" 178982 43094 "NearestStart" "1" 197067200 197068353 1154 "0057... (3 Replies)
Discussion started by: paolo.kunder
3 Replies

7. Shell Programming and Scripting

Merge with common column

hi i have two files and i wanted to join them using common column. try to do this using "join" command but that did not help. File 1: 123 9a.vcf hy92.vcf hy90.vcf Index Ref Alt Ref Alt Ref Alt 315 14 0 7 4 ... (6 Replies)
Discussion started by: empyrean
6 Replies

8. Shell Programming and Scripting

Multiple file merge by column

Hello all, I am quite new in linux shell scripting and I have this issue. I ve got some files including measurements taken every 10minutes for a whole day. File name format is: 00.00, 00.10, 00.20,....23.50 File structure is: x | y | temperature x and y is the same in all files (same... (12 Replies)
Discussion started by: atzounis
12 Replies

9. Shell Programming and Scripting

Seperated by columns, merge in a file, sort them on common column

Hi All, I have 4 files in below format. I took them as an example. File 1: Cut from position 1-4 then 6-7 then 8-14 then rest left and make them as columns in one new file. Inserting character H to the initial of all line like HCTOT. CTOT 456787897 Low fever CTOR 556712345 High fever... (2 Replies)
Discussion started by: Mannu2525
2 Replies

10. UNIX for Beginners Questions & Answers

Cut specific column from 2 file and merge

Hi ALL, I have two file. I need to combine these two file based on a layout. I used the below code and able to extract the record. But now able to insert that to a 3'rd file in between the extract FILE 1 CAID NUMBER 1-20 TID NUMBER 21-22 LABEL CHAR 23-44 BASE 45-60... (5 Replies)
Discussion started by: arunkumar_mca
5 Replies
Hash::Merge::Simple(3pm)				User Contributed Perl Documentation				  Hash::Merge::Simple(3pm)

NAME
Hash::Merge::Simple - Recursively merge two or more hashes, simply VERSION
version 0.051 SYNOPSIS
use Hash::Merge::Simple qw/ merge /; my $a = { a => 1 }; my $b = { a => 100, b => 2}; # Merge with righthand hash taking precedence my $c = merge $a, $b; # $c is { a => 100, b => 2 } ... Note: a => 100 has overridden => 1 # Also, merge will take care to recursively merge any subordinate hashes found my $a = { a => 1, c => 3, d => { i => 2 }, r => {} }; my $b = { b => 2, a => 100, d => { l => 4 } }; my $c = merge $a, $b; # $c is { a => 100, b => 2, c => 3, d => { i => 2, l => 4 }, r => {} } # You can also merge more than two hashes at the same time # The precedence increases from left to right (the rightmost has the most precedence) my $everything = merge $this, $that, $mine, $yours, $kitchen_sink, ...; DESCRIPTION
Hash::Merge::Simple will recursively merge two or more hashes and return the result as a new hash reference. The merge function will descend and merge hashes that exist under the same node in both the left and right hash, but doesn't attempt to combine arrays, objects, scalars, or anything else. The rightmost hash also takes precedence, replacing whatever was in the left hash if a conflict occurs. This code was pretty much taken straight from Catalyst::Utils, and modified to handle more than 2 hashes at the same time. USAGE
Hash::Merge::Simple->merge( <hash1>, <hash2>, <hash3>, ..., <hashN> ) Hash::Merge::Simple::merge( <hash1>, <hash2>, <hash3>, ..., <hashN> ) Merge <hash1> through <hashN>, with the nth-most (rightmost) hash taking precedence. Returns a new hash reference representing the merge. NOTE: The code does not currently check for cycles, so infinite loops are possible: my $a = {}; $a->{b} = $a; merge $a, $a; NOTE: If you want to avoid giving/receiving side effects with the merged result, use "clone_merge" or "dclone_merge" An example of this problem (thanks Uri): my $left = { a => { b => 2 } } ; my $right = { c => 4 } ; my $result = merge( $left, $right ) ; $left->{a}{b} = 3 ; $left->{a}{d} = 5 ; # $result->{a}{b} == 3 ! # $result->{a}{d} == 5 ! Hash::Merge::Simple->clone_merge( <hash1>, <hash2>, <hash3>, ..., <hashN> ) Hash::Merge::Simple::clone_merge( <hash1>, <hash2>, <hash3>, ..., <hashN> ) Perform a merge, clone the merge, and return the result This is useful in cases where you need to ensure that the result can be tweaked without fear of giving/receiving any side effects This method will use Clone to do the cloning Hash::Merge::Simple->dclone_merge( <hash1>, <hash2>, <hash3>, ..., <hashN> ) Hash::Merge::Simple::dclone_merge( <hash1>, <hash2>, <hash3>, ..., <hashN> ) Perform a merge, clone the merge, and return the result This is useful in cases where you need to ensure that the result can be tweaked without fear of giving/receiving any side effects This method will use Storable (dclone) to do the cloning SEE ALSO
Hash::Merge Catalyst::Utils Clone Storable ACKNOWLEDGEMENTS
This code was pretty much taken directly from Catalyst::Utils: Sebastian Riedel "sri@cpan.org" Yuval Kogman "nothingmuch@woobling.org" AUTHOR
Robert Krimen <robertkrimen@gmail.com> COPYRIGHT AND LICENSE
This software is copyright (c) 2010 by Robert Krimen. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.10.1 2010-12-07 Hash::Merge::Simple(3pm)
All times are GMT -4. The time now is 11:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy