Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Search for string in a file then compare it with excel files entry Post 302864171 by Anamika08 on Wednesday 16th of October 2013 05:53:36 AM
Old 10-16-2013
Search for string in a file then compare it with excel files entry

All,
i have a file text.log:
cover6
cover3
cover2
cover4

other file is abc.log as :
0
0
1
0

Then I have a excel file result.xls that contains:

Name Path Pass
cover2
cover3
cover6
cover4

Now I want to write a perl script that will check if 1st column and 2nd row of results.xls is equal to first string of text.log then, write 1st string of abc.log in 3rd column 1st row of result.xls i.e under Pass field.

example : Row 2 of result.xls contain cover2 but in text.log cover2 is in 3rd line. So, row2 3rd column of result.xls will contain string in 3rd line of abc.log i.e 1.

Similarly for all rows.

Regards,
Anamika

---------- Post updated at 04:53 AM ---------- Previous update was at 04:28 AM ----------

Quote:
Originally Posted by Anamika08
All,
i have a file text.log:
cover6
cover3
cover2
cover4

other file is abc.log as :
0
0
1
0

Then I have a excel file result.xls that contains:

Name Path Pass
cover2
cover3
cover6
cover4

Now I want to write a perl script that will check if 1st column and 2nd row of results.xls is equal to first string of text.log then, write 1st string of abc.log in 3rd column 1st row of result.xls i.e under Pass field.

example : Row 2 of result.xls contain cover2 but in text.log cover2 is in 3rd line. So, row2 3rd column of result.xls will contain string in 3rd line of abc.log i.e 1.

Similarly for all rows.

Regards,
Anamika

Last edited by Anamika08; 10-16-2013 at 06:53 AM.. Reason: modified details
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

count the number of files which have a search string, but counting the file only once

I need to count the number of files which have a search string, but counting the file only once if search string is found. eg: File1: Please note that there are 2 occurances of "aaa" aaa bbb ccc aaa File2: Please note that there are 3 occurances of "aaa" aaa bbb ccc... (1 Reply)
Discussion started by: sudheshnaiyer
1 Replies

2. Shell Programming and Scripting

Perl: Search for string on line then compare numbers!

Hi All, I have a file that I need to be able to find a pattern match on a line, take the number on that line check if its >0.9 or <0.1 and if this is true write the line to output.out file. An example of 4 lines in my file is: 1. driver.I177.I11.net010 1.48622200477273e-05 2.... (2 Replies)
Discussion started by: Crypto
2 Replies

3. UNIX for Dummies Questions & Answers

problem with grep on search string in a txt file over multiple files

I have a couple of things I got stuck on 1) I have a text file containing 25k search string that I need to search against compressed file. I have used this command but somehow it doesn't seems to use all the search terms. I have put one search string per line in the txt file (I clean up... (2 Replies)
Discussion started by: m00
2 Replies

4. UNIX for Dummies Questions & Answers

To compare first two columns in an excel file

Hi All, i have a excel sheet with two columns as below. column1 column2 100 100 200 300 300 400 400 400 500 600 i need to compare the values these two columns and the output should be printed in the third column...if these values are equal the output should be green and if these... (2 Replies)
Discussion started by: arunmanas
2 Replies

5. UNIX for Dummies Questions & Answers

Compare 2 files print the lines of file 2 that contain a string from file 1

Hello I am a new unix user, and I have a work related task to compare 2 files and print all of the lines in file 2 that contain a string from file 1 Note: the fields are in different columns in the files. I suspect the is a good use for awk? Thanks for your time & help File 1 123 232 W343... (6 Replies)
Discussion started by: KevinRidley
6 Replies

6. Shell Programming and Scripting

Compare columns of multiple files and print those unique string from File1 in an output file.

Hi, I have multiple files that each contain one column of strings: File1: 123abc 456def 789ghi File2: 123abc 456def 891jkl File3: 234mno 123abc 456def In total I have 25 of these type of file. (5 Replies)
Discussion started by: owwow14
5 Replies

7. Shell Programming and Scripting

Perl script to Merge contents of 2 different excel files in a single excel file

All, I have an excel sheet Excel1.xls that has some entries. I have one more excel sheet Excel2.xls that has entries only in those cells which are blank in Excel1.xls These may be in different workbooks. They are totally independent made by 2 different users. I have placed them in a... (1 Reply)
Discussion started by: Anamika08
1 Replies

8. Shell Programming and Scripting

Search string within a file and list common words from the line having the search string

Hi, Need your help for this scripting issue I have. I am not really good at this, so seeking your help. I have a file looking similar to this: Hello, i am human and name=ABCD. How are you? Hello, i am human and name=PQRS. I am good. Hello, i am human and name=ABCD. Good bye. Hello, i... (12 Replies)
Discussion started by: royzlife
12 Replies

9. Shell Programming and Scripting

Shell script to search all files for every string in another file

Hello All I have a pattern.txt file in source directory ((/project/source/) in linux server and data looks like: 123abc17 234cdf19 235ifg20 I have multiple log files in log directory (/project/log/) in linux server and data for one log file looks like: <?xml version="1.0" processid... (11 Replies)
Discussion started by: pred55
11 Replies

10. UNIX for Beginners Questions & Answers

Search strings from a file in files in a directory recursively; then print the string with a status

Hi All, I hope somebody would be able to help me. I would need to search a string coming from a file, example file.txt: dog cat goat horse fish For every string, I would need to know if there are any files inside a directory(recursively) that contains the string regardless of case.... (9 Replies)
Discussion started by: kokoro
9 Replies
Bio::SeqIO::excel(3pm)					User Contributed Perl Documentation				    Bio::SeqIO::excel(3pm)

NAME
Bio::SeqIO::excel - sequence input/output stream from a MSExcel-formatted table SYNOPSIS
#It is probably best not to use this object directly, but #rather go through the SeqIO handler system. Go: $stream = Bio::SeqIO->new(-file => $filename, -format => 'excel'); while ( my $seq = $stream->next_seq() ) { # do something with $seq } DESCRIPTION
This class transforms records in a MS Excel workbook file into Bio::Seq objects. It is derived from the table format module and merely defines additional properties and overrides the way to get data from the file and advance to the next record. The module permits specifying which columns hold which type of annotation. The semantics of certain attributes, if present, are pre- defined, e.g., accession number and sequence. Additional attributes may be added to the annotation bundle. See Bio::SeqIO::table for a complete list of parameters and capabilities. You may also specify the worksheet from which to obtain the data, and after finishing one worksheet you may change the name to keep reading from another worksheet (in the same file). This module depends on Spreadsheet::ParseExcel to parse the underlying Excel file. FEEDBACK
Mailing Lists User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to one of the Bioperl mailing lists. Your participation is much appreciated. bioperl-l@bioperl.org - General discussion http://bioperl.org/wiki/Mailing_lists - About the mailing lists Support Please direct usage questions or support issues to the mailing list: bioperl-l@bioperl.org rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible. Reporting Bugs Report bugs to the Bioperl bug tracking system to help us keep track the bugs and their resolution. Bug reports can be submitted via email or the web: https://redmine.open-bio.org/projects/bioperl/ AUTHOR - Hilmar Lapp Email hlapp at gmx.net APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ new Title : new Usage : $stream = Bio::SeqIO->new(-file => $filename, -format => 'excel') Function: Returns a new seqstream Returns : A Bio::SeqIO stream for a MS Excel format Args : Supports the same named parameters as Bio::SeqIO::table, except -delim, which obviously does not apply to a binary format. In addition, the following parameters are supported. -worksheet the name of the worksheet holding the table; if unspecified the first worksheet will be used worksheet Title : worksheet Usage : $obj->worksheet($newval) Function: Get/set the name of the worksheet holding the table. The worksheet name may also be a numeric index. You may change the value during parsing at any time in order to start reading from a different worksheet (in the same file). Example : Returns : value of worksheet (a scalar) Args : on set, new value (a scalar or undef, optional) close Title : close Usage : Function: Close and/or release the resources used by this parser instance. We override this here in order to free up the worksheet and other related objects. Example : Returns : Args : Internal methods All methods with a leading underscore are not meant to be part of the 'official' API. They are for use by this module only, consider them private unless you are a developer trying to modify this module. _worksheet Title : _worksheet Usage : $obj->_worksheet($newval) Function: Get/set the worksheet object to be used for accessing cells. Example : Returns : value of _worksheet (a Spreadsheet::ParseExcel::Worksheet object) Args : on set, new value (a Spreadsheet::ParseExcel::Worksheet object or undef, optional) _next_record Title : _next_record Usage : Function: Navigates the underlying file to the next record. We override this here in order to adapt navigation to data in an Excel worksheet. Example : Returns : TRUE if the navigation was successful and FALSE otherwise. Unsuccessful navigation will usually be treated as an end-of-file condition. Args : _get_row_values Title : _get_row_values Usage : Function: Get the values for the current line (or row) as an array in the order of columns. We override this here in order to adapt access to column values to data contained in an Excel worksheet. Example : Returns : An array of column values for the current row. Args : perl v5.14.2 2012-03-02 Bio::SeqIO::excel(3pm)
All times are GMT -4. The time now is 01:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy