Sponsored Content
Top Forums Shell Programming and Scripting Perl search csv fileA where two strings exist on another csv fileB Post 302622835 by PerlNewbRP on Thursday 12th of April 2012 04:18:10 PM
Old 04-12-2012
Hi

I'd like to print each line where the columns match, so for example the result will show something like this:

to OUTPUTfile.log:

Uk, London, Application, datetime, LaterDateTime, Today This occured blah and I care

Because it had the work 'application' which matched the string from the other file in colum[0] (in fileB), and it contained the string ' This occured blah ' which occured in column[5] (in fileB).

There will be many rows in both files.

Thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replacing strings in a log file and saves as a new csv

Hello Im new here.I need to replace strings and change it into csv format, or at least saves the file as csv if that would work :p. Heres an example of my scenario 1) I have a log file, named abc.log, and its like a txt based file anyway, and the content looks like this ... (2 Replies)
Discussion started by: tententen
2 Replies

2. Shell Programming and Scripting

Replacing strings in csv file.

Hi, I have a problem.. 1) I have a file that contains the lines as below : VRF-TM_DummyLab/mse02.lab,mse02.lab,ge-2/0/7.222 VRF-EMS_HUAWEI_MSAN_208/mse01.lab,mse01.lab,xe-1/0/0.208 2) I need a method to read this file, line by line from :... (5 Replies)
Discussion started by: msafwan82
5 Replies

3. Shell Programming and Scripting

Copying lines from fileA if they start by a word from fileB

Hi I'm in the need of a script that basically takes two files and generates a 3rd. It reads from fileA and fileB and copies lines from fileA if they start by a word of fileB. for example fileA The dog is beautful Where is your cat Why are you sad? Help me! fileB The Where tree dog... (4 Replies)
Discussion started by: FrancoisCN
4 Replies

4. 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

5. Shell Programming and Scripting

Comparing Strings in 2 .csv/txt files?

EDIT: My problems have been solved thanks to the help of bartus11 and pravin27 This code is just to help me learn. It serves no purpose other than that. Here's a sample csv that I'm working with - #listofpeeps.csv Jackie Chan,1954,M Chuck Norris,1930,M Bruce Lee,1940,M This code is... (13 Replies)
Discussion started by: chickeneaterguy
13 Replies

6. Shell Programming and Scripting

Extract strings from multiple lines into one csv file

Hi all, Please go through my requirement. I have a log file in the location /opt/WebSphere61/AppServer/profiles/EMQbatchprofile/logs/EMQbatch This file contains the follwing pattern data <af type="tenured" id="42" timestamp="May 14 13:44:13 2011" intervalms="955.624"> <minimum... (8 Replies)
Discussion started by: satish.vampire
8 Replies

7. Shell Programming and Scripting

CSV to SQL insert: Awk for strings with multiple lines in csv

Hi Fellows, I have been struggling to fix an issue in csv records to compose sql statements and have been really losing sleep over it. Here is the problem: I have csv files in the following pipe-delimited format: Column1|Column2|Column3|Column4|NEWLINE Address Type|some descriptive... (4 Replies)
Discussion started by: khayal
4 Replies

8. Shell Programming and Scripting

awk read column csv and search in other csv

hi, someone to know how can i read a specific column of csv file and search the value in other csv columns if exist the value in the second csv copy entire row with all field in a new csv file. i suppose that its possible using awk but i m not expertise thanks in advance (8 Replies)
Discussion started by: giankan
8 Replies

9. Shell Programming and Scripting

Read in search strings from text file, search for string in second text file and output to CSV

Hi guys, I have a text file named file1.txt that is formatted like this: 001 , ID , 20000 002 , Name , Brandon 003 , Phone_Number , 616-234-1999 004 , SSNumber , 234-23-234 005 , Model , Toyota 007 , Engine ,V8 008 , GPS , OFF and I have file2.txt formatted like this: ... (2 Replies)
Discussion started by: An0mander
2 Replies

10. Shell Programming and Scripting

Grep from FileA, search in FileB, edit FileC > Output

Hello, Similar question to my previous posts. I am sorry for the trouble... Just checked my old threads but I can not implement any solution into this case.. My aim is to grab each line in fileA, check it in fileB and merge with fileC (tab separated) in corresponding line as given below: FileA:... (2 Replies)
Discussion started by: baris35
2 Replies
DateTime::Format::Builder::Parser::generic(3pm) 	User Contributed Perl Documentation	   DateTime::Format::Builder::Parser::generic(3pm)

NAME
DateTime::Format::Builder::Parser::generic - Useful routines METHODS
Useful new Standard constructor. Returns a blessed hash; any arguments are placed in the hash. This is useful for storing information between methods. generic_parser This is a method provided solely for the benefit of "Parser" implementations. It semi-neatly abstracts a lot of the work involved. Basically, it takes parameters matching the assorted callbacks from the parser declarations and makes a coderef out of it all. Currently recognized callbacks are: o on_match o on_fail o preprocess o postprocess Methods for subclassing These are methods you should define when writing your own subclass. Note: these methods do not exist in this class. There is no point trying to call "$self->SUPER::do_match( ... )". do_match "do_match" is the first phase. Arguments are the date and @args. "self", "label", "args". Return value must be defined if you match successfully. post_match "post_match" is called after the appropriate callback out of "on_match"/"on_fail" is done. It's passed the date, the return value from "do_match" and the parsing hash. Its return value is used as the "post" argument to the "postprocess" callback, and as the second argument to "make". make "make" takes the original input, the return value from "post_match" and the parsing hash and should return a "DateTime" object or undefined. Delegations For use of "Parser", this module also delegates "valid_params" and "params". This is just convenience to save typing the following: DateTime::Format::Builder::Parser->valid_params( blah ) Instead we get to type: $self->valid_params( blah ); __PACKAGE__->valid_params( blah ); WRITING A SUBCLASS
Rather than attempt to explain how it all works, I think it's best if you take a look at Regex.pm and Strptime.pm as examples and work from there. THANKS
See DateTime::Format::Builder. SUPPORT
Support for this module is provided via the datetime@perl.org email list. See http://lists.perl.org/ for more details. Alternatively, log them via the CPAN RT system via the web or email: http://perl.dellah.org/rt/dtbuilder bug-datetime-format-builder@rt.cpan.org This makes it much easier for me to track things and thus means your problem is less likely to be neglected. LICENCE AND COPYRIGHT
Copyright X Iain Truskett, 2003. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.000 or, at your option, any later version of Perl 5 you may have available. The full text of the licences can be found in the Artistic and COPYING files included with this module, or in perlartistic and perlgpl as supplied with Perl 5.8.1 and later. AUTHOR
Iain Truskett <spoon@cpan.org> SEE ALSO
"datetime@perl.org" mailing list. http://datetime.perl.org/ perl, DateTime, DateTime::Format::Builder, DateTime::Format::Builder::Parser. perl v5.10.1 2010-03-14 DateTime::Format::Builder::Parser::generic(3pm)
All times are GMT -4. The time now is 03:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy