Sponsored Content
Top Forums Shell Programming and Scripting Match list of strings in File A and compare with File B, C and write to a output file in CSV format Post 302713305 by Corona688 on Wednesday 10th of October 2012 12:52:20 PM
Old 10-10-2012
You have mentioned three input files but only included two, and not clearly mentioned which is A, which is B, and which is C(missing).

If they are short, it would be just as easy to paste them into your post using code tags: {code}stuff{/code} except with [] instead of {}.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to compare two csv files values and write into another csv file

Hi all, Am new to scripting. So i just need your ideas to help me out. Here goes my requirement. I have two csv files 1.csv 2.csv abc,1.24 abc,1 def,2.13 def,1 I need to compare the first column of 1.csv with 2.csv and if matches then need to compare... (2 Replies)
Discussion started by: chinnahyd
2 Replies

2. Shell Programming and Scripting

format output in csv file

I am sending the output of a file to .csv file. The output should look like this: Total Customers Processed:,8 Total Customers Skipped:,0 Total Customers Added:,8 Total Customers Changed:,0 Total Policies Deleted:,0 Total Policies Failed:,0 total:,8 Now i want this output in... (1 Reply)
Discussion started by: Prashant Jain
1 Replies

3. Shell Programming and Scripting

extract strings from file and display in csv format

Hello All, I have a file whose data looks something like this I want to extract just the id, name and city fields in a csv format and sort them by id. Output should look like this. 1,psi,zzz 2,beta,pqr 3,theta,xyz 4,alpha,abc 5,gamma,jkl (12 Replies)
Discussion started by: grajp002
12 Replies

4. Shell Programming and Scripting

Csv format output file using scirpt

Hi All, I get the test result file daily after running the main test script. from the resultfile, need to fetch only server info and status and put them in tabular format in a file and as well in CSV format output file. I tried using awk command but am not able to put them in tabluar... (6 Replies)
Discussion started by: Optimus81
6 Replies

5. Shell Programming and Scripting

Compare 2 text file with 1 column in each file and write mismatch data to 3rd file

Hi, I need to compare 2 text files with around 60000 rows and 1 column. I need to compare these and write the mismatch data to 3rd file. File1 - file2 = file3 wc -l file1.txt 58112 wc -l file2.txt 55260 head -5 file1.txt 101214200123 101214700300 101250030067 101214100500... (10 Replies)
Discussion started by: Divya Nochiyil
10 Replies

6. Shell Programming and Scripting

Compare 2 files of csv file and match column data and create a new csv file of them

Hi, I am newbie in shell script. I need your help to solve my problem. Firstly, I have 2 files of csv and i want to compare of the contents then the output will be written in a new csv file. File1: SourceFile,DateTimeOriginal /home/intannf/foto/IMG_0713.JPG,2015:02:17 11:14:07... (8 Replies)
Discussion started by: refrain
8 Replies

7. Shell Programming and Scripting

Compare two and write updated output in third file

Hi Linux Experts. I have a requirement where i need to update the thousands of table definitions to extend the column length and character set therefore i am looking for some sort of linux script which i can use to update the length and chacterset. I have two files In first file i have 7... (1 Reply)
Discussion started by: Black-Linux
1 Replies

8. Shell Programming and Scripting

How to parse this file using awk and output in CSV format?

My source file looks like this: Cust-Number = "101" Cust-Name="Joe" Cust-Town="London" Cust-hobby="tennis" Cust-purchase="200" Cust-Number = "102" Cust-Name="Mary" Cust-Town="Newyork" Cust-hobby="reading" Cust-purchase="125" Now I want to parse this file (leaving out hobby) and... (10 Replies)
Discussion started by: Balav
10 Replies

9. UNIX for Beginners Questions & Answers

Use strings from nth field from one file to match strings in entire line in another file, awk

I cannot seem to get what should be a simple awk one-liner to work correctly and cannot figure out why. I would like to use patterns from a specific field in one file as regex to search for matching strings in the entire line ($0) of another file. I would like to output the lines of File2 which... (1 Reply)
Discussion started by: jvoot
1 Replies

10. Programming

Python or Shell script to Grep strings from input file and output in csv format

Hi Experts, I am writing a python script to grep string from file and display output in csv file as in attached screenshot https://drive.google.com/file/d/1gfUUdfmQma33tz65NskThYDhkZUGQO0H/view Input file(result_EPFT_config_device) Below is the python script i have prepared as of... (1 Reply)
Discussion started by: as7951
1 Replies
Exporter::Easy(3pm)					User Contributed Perl Documentation				       Exporter::Easy(3pm)

NAME
Exporter::Easy - Takes the drudgery out of Exporting symbols SYNOPSIS
In module YourModule.pm: package YourModule; use Exporter::Easy ( OK => [ '$munge', 'frobnicate' ] # symbols to export on request ); In other files which wish to use YourModule: use ModuleName qw(frobnicate); # import listed symbols frobnicate ($left, $right) # calls YourModule::frobnicate DESCRIPTION
Exporter::Easy makes using Exporter easy. In it's simplest case it allows you to drop the boilerplate code that comes with using Exporter, so require Exporter; use base qw( Exporter ); use vars qw( @EXPORT ); @EXPORT = ( 'init' ); becomes use Exporter::Easy ( EXPORT => [ 'init' ] ); and more complicated situations where you use tags to build lists and more tags become easy, like this use Exporter::Easy ( EXPORT => [qw( init :base )], TAGS => [ base => [qw( open close )], read => [qw( read sysread readline )], write => [qw( print write writeline )], misc => [qw( select flush )], all => [qw( :base :read :write :misc)], no_misc => [qw( :all !:misc )], ], OK => [qw( some other stuff )], ); This will set @EXPORT, @EXPORT_OK, @EXPORT_FAIL and %EXPORT_TAGS in the current package, add Exporter to that package's @ISA and do a "use vars" on all the variables mentioned. The rest is handled as normal by Exporter. HOW TO USE IT
Put use Exporter::Easy ( KEY => value, ...); in your package. Arguments are passes as key-value pairs, the following keys are available TAGS The value should be a reference to a list that goes like (TAG_NAME, TAG_VALUE, TAG_NAME, TAG_VALUE, ...), where TAG_NAME is a string and TAG_VALUE is a reference to an array of symbols and tags. For example TAGS => [ file => [ 'open', 'close', 'read', 'write'], string => [ 'length', 'substr', 'chomp' ], hash => [ 'keys', 'values', 'each' ], all => [ ':file', ':string', ':hash' ], some => [':all', '!open', ':hash'], ] This is used to fill the %EXPORT_TAGS in your package. You can build tags from other tags - in the example above the tag "all" will contain all the symbols from "file", "string" and "hash". You can also subtract symbols and tags - in the example above, "some" contains the symbols from all but with "open" removed and all the symbols from "hash" removed. The rule is that any symbol starting with a ':' is taken to be a tag which has been defined previously (if it's not defined you'll get an error). If a symbol is preceded by a '!' it will be subtracted from the list, otherwise it is added. If you try to redefine a tag you will also get an error. All the symbols which occur while building the tags are automatically added your package's @EXPORT_OK array. OK The value should be a reference to a list of symbols and tags (which will be exapanded). These symbols will be added to the @EXPORT_OK array in your package. Using OK and and OK_ONLY together will give an error. OK_ONLY The value should be a reference to a list of symbols and tags (which will be exapanded). The @EXPORT_OK array in your package will contains only these symbols.. This totally overrides the automatic population of this array. If you just want to add some symbols to the list that Exporter::Easy has automatically built then you should use OK instead. Using OK_ONLY and OK together will give an error. EXPORT The value should be a reference to a list of symbol names and tags. Any tags will be expanded and the resulting list of symbol names will be placed in the @EXPORT array in your package. The tag created by the ALL key is not available at this stage. FAIL The value should be a reference to a list of symbol names and tags. The tags will be expanded and the resulting list of symbol names will be placed in the @EXPORT_FAIL array in your package. They will also be added to the @EXPORT_OK list. ALL The value should be the name of tag that doesn't yet exist. This tag will contain a list of all symbols which can be exported. ISA If you set this to 0 then Exporter will not be added to your @ISA list. VARS If this is set to 1 or not provided then all $, @ and % variables mentioned previously will be available to use in your package as if you had done a "use vars" on them. If it's set to a reference to a list of symbols and tags then only those symbols will be available. If it's set to 0 then you'll have to do your own "use vars" in your package. PROCESSING ORDER
We need take the information provided and build @EXPORT, @EXPORT_OK, @EXPORT_FAIL and %EXPORT_TAGS in the calling package. We may also need to build a tag with all of the symbols and to make all the variables useable under strict. The arguments are processed in the following order: TAGS, EXPORT, OK, OK_ONLY and FAIL, ALL, VARS and finally ISA. This means you cannot use the tag created by ALL anywhere except in VARS (although vars defaults to using all symbols anyway). SEE ALSO
For details on what all these arrays and hashes actually do, see the Exporter documentation. AUTHOR
Written by Fergal Daly <fergal@esatclear.ie>. LICENSE
Under the same license as Perl itself perl v5.12.4 2004-07-24 Exporter::Easy(3pm)
All times are GMT -4. The time now is 12:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy