awk - Matching columns between 2 files and reordering results
I am trying to match 4 colums (first_name,last_name,dob,ssn) between 2 files and when there is an exact match I need to write out these matches to a new file with a combination of fields from file1 and file2. I've managed to come up with a way to match these 2 files based on the columns (see below) but I'm not sure how to control which columns from either file1 or file2 I can output to a final results file.
Here's an example of my files below.
file1: Min List
file2: Master List
file3: Results List
Notice that the "id" column from file1 is in file3 the results file and all others are from file2 in different columns. Any help on this is greatly appreciated.
Last edited by Scott; 10-20-2010 at 01:23 PM..
Reason: Please use code tags
Hey,
I have two files that have exactly the same format. They are both tab-delimited and contain 12 columns. However the # of rows vary. What I want to do is match columns # 5,6 and 7 between the two files. If they do match exactly (based on numbers) then I want the whole row from file 2 to... (1 Reply)
Hi to all,
I have two separated files:
FILE1
"V1" "V2" "V3"
Mary James Nicole
Robert Francisco Sophie
Nancy Antony Matt
Josephine Louise Rose
Mark Simon
Charles
FILE2
"V1" "V2" "V3"... (2 Replies)
Hi!
I need to merge two files when col1 (x:x:x) matching and adds second column from file1.txt.
# cat 1.txt
aaa;a12
bbb;b13
ccc;c33
ddd;d55
eee;e11
# cat 2.txt
bbb;b55;34444;d55
aaa;a15;35666;a44
I try with this awk and I get succesfully first column from 1.txt:
# awk -F";"... (2 Replies)
Hi,
I need to join two files together with one common value in a column. I think I can use awk or join or a combination but I can't quite get it.
Basically my data looks like this, with the TICKER columns matching up in each file
File1
TICKER,column 1, column, 2, column, 3, column 4
... (6 Replies)
Hello Help,
2356798 7689867 999 000
123678 20385907 9797 666
17978975 87468976 968978 98798
I am trying to have out put which actually look for the third column value of 9797 and then it insert line there after with first, second column value exactly as the previous line and replace the third... (3 Replies)
Given this file (I separated them in block to make my explanation clearer):
92157768877;Sof_deme_Fort_Email_am_%yyyy%%mm%%dd%;EMAIL;20/02/2015;1;0;0
92157768877;Sof_trav_Fort_Email_am_%yyyy%%mm%%dd%;EMAIL;20/02/2015;1;0;0
91231838895;Sof_deme_faible_Email_am;EMAIL;26/01/2015;1 0;0... (1 Reply)
I know I'm not the first one asking this but my code still does not work:
File 1: gi|1283| tRNAscan exon 87020 88058 . - . transcript_id "Parent=tRNA-Tyr5.r01";
gi|3283| tRNAscan exon 97020 97058 . + . transcript_id "Parent=tRNA-Tyr6.r01";
gi|4283| rRNAscan exon 197020 197058 . - . transcript_id... (5 Replies)
Hi All,
I am looking to join two files where column 1 of file A matches with column 1 of file B and column 5 of files A matches with column 2 of file B. After joining the files based on above condition, out should contain entire line of file A and column 3, 4 and 5 of file B.
Here is sample... (8 Replies)
I am using awk to match columns and output based on those matches. For some reason it is not printing matching columns, am I missing something?
Operating system - windows with cygwin.
Command that I am using:
sed 's/]*,]*/,/g' $tempdir/file1 > $tempdir/file1.$$ && awk -F, 'FNR==NR{f2=$2... (7 Replies)
Discussion started by: dis0wned
7 Replies
LEARN ABOUT SUSE
html::formatter
HTML::Formatter(3) User Contributed Perl Documentation HTML::Formatter(3)NAME
HTML::Formatter - Base class for HTML formatters
SYNOPSIS
use HTML::FormatSomething;
my $infile = "whatever.html";
my $outfile = "whatever.file";
open OUT, ">$outfile"
or die "Can't write-open $outfile: $!
Aborting";
binmode(OUT);
print OUT HTML::FormatSomething->format_file(
$infile,
'option1' => 'value1',
'option2' => 'value2',
...
);
close(OUT);
DESCRIPTION
HTML::Formatter is a base class for classes that take HTML and format it to some output format. When you take an object of such a base
class and call "$formatter->format( $tree )" with an HTML::TreeBuilder (or HTML::Element) object, they return the
HTML formatters are able to format a HTML syntax tree into various printable formats. Different formatters produce output for different
output media. Common for all formatters are that they will return the formatted output when the format() method is called. The format()
method takes a HTML::Element object (usually the HTML::TreeBuilder root object) as parameter.
Here are the four main methods that this class provides:
SomeClass->format_file( $filename, option1 => value1, option2 => value2, ... )
This returns a string consisting of the result of using the given class to format the given HTML file according to the given (optional)
options. Internally it calls "SomeClass->new( ... )->format( ... )" on a new HTML::TreeBuilder object based on the given HTML file.
SomeClass->format_string( $html_source, option1 => value1, option2 => value2, ... )
This returns a string consisting of the result of using the given class to format the given HTML source according to the given
(optional) options. Internally it calls "SomeClass->new( ... )->format( ... )" on a new HTML::TreeBuilder object based on the given
source.
$formatter = SomeClass->new( option1 => value1, option2 => value2, ... )
This creates a new formatter object with the given options.
$render_string = $formatter->format( $html_tree_object )
This renders the given HTML object accerting to the options set for $formatter.
After you've used a particular formatter object to format a particular HTML tree object, you probably should not use either again.
SEE ALSO
HTML::FormatText, HTML::FormatPS, HTML::FormatRTF
HTML::TreeBuilder, HTML::Element, HTML::Tree
COPYRIGHT
Copyright (c) 1995-2002 Gisle Aas, and 2002- Sean M. Burke. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose.
AUTHOR
Current maintainer: Sean M. Burke <sburke@cpan.org>
Original author: Gisle Aas <gisle@aas.no>
perl v5.12.1 2004-06-02 HTML::Formatter(3)