Sponsored Content
Top Forums Shell Programming and Scripting Search complicated strings on file Post 302419769 by Orbix on Saturday 8th of May 2010 02:00:17 PM
Old 05-08-2010
Search complicated strings on file

Can someone help me? I been figuring out how I can search and extract a complicated search string from a file. The whole string is delimited by a period. And the file where I'm searching is composed of differnt string such as that. For example, I have this search string:

Quote:
sim.lim.13_60.colorValidationResponse
and I have a file containing:

Quote:
acm.omg.19_10.figureRetrieveAnswer
mai.lim.13_60.colorValidationResponse
hmo.bimx.10_10.staffInformationFile
sim.nam.13_60.colorValidationResponse
sim.lim.12_80.colorValidationResponse
sim.lim.13_60.colorValidationRequest
sim.lim.14_90.colorValidationResponse
sim.nam.13_60.colorValidationResponse
Now I need four outputs since my search string is divided into four strings delimited by period:

Quote:
1st Output:
mai.lim.13_60.colorValidationResponse

2nd Output:
sim.nam.13_60.colorValidationResponse
sim.nam.13_60.colorValidationResponse

3rd Output:
sim.lim.12_80.colorValidationResponse
sim.lim.14_90.colorValidationResponse

4th Output:
sim.lim.13_60.colorValidationRequest
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find information from complicated strings

Hi experts, I have the file with these lines: var1=thu_13:12:32,var2=Microsoft,var3=240ms,var4=Mozilla/4.0_(sun;_MSIR_3-4;_windows.;_NET_1.1323.53 var1=thu_13:13:32,var2=Microsoft,var3=213ms,var4=Mozilla/4.0_(sun;_MSIR_3-4;_windows.;_NET_1.1323.53... (9 Replies)
Discussion started by: lalelle
9 Replies

2. Shell Programming and Scripting

How to search multiple strings in a file

Hi All, I want to search all the ksh scripts that has following details. 1. Search for "exit 0" 2. Search for "sqlldr" or sqlplus" 3. In the above files i want to search for all the script that has no "case" in it. Please advice. Thanks, Deep (2 Replies)
Discussion started by: deepakpv
2 Replies

3. Shell Programming and Scripting

complicated search within file

Hi, I have following problem. I have a file with time stamps and some data describing what happened between time stamps. Something like this: 10:00 meeting with K meeting with L 11:00 lunch 12:00 work with K 13:00 From this file I have to get a file with... (7 Replies)
Discussion started by: mmike
7 Replies

4. Shell Programming and Scripting

search file between last occurence of 2 strings

I need to extract the last block of /== START OF SQLPLUS ==/ and /== END OF SQLPLUS ==/. The logifle is written to several times in a day using >> to append. I need a solution using grep/sed. logfile looks like this START OF LOGFILE /== START OF SQLPLUS ==/ ERROR /== END OF SQLPLUS... (5 Replies)
Discussion started by: hanton
5 Replies

5. Emergency UNIX and Linux Support

Complicated SED search required

Hi All, I'm trying to extract all the description fields from a MIB file which contain multiple instances of the following text: ENTERPRISE compaq VARIABLES { sysName, cpqHoTrapFlags, cpqSsBoxCntlrHwLocation, cpqSsBoxCntlrIndex, cpqSsBoxBusIndex,... (10 Replies)
Discussion started by: badoshi
10 Replies

6. Shell Programming and Scripting

Script Search replace - complicated

I have a text file for which i need a script which does some fancy search and replace. Basically i want to loop through each line, if i find an occurance of certain string format then i want to carry on search on replace another line, once i replaced this line i will contine to search for the... (7 Replies)
Discussion started by: kelseyh
7 Replies

7. Shell Programming and Scripting

Search multiple Strings in a File

Hi I want to search multiple strings in a file . But the search should start with "From" Keyword and end with before "Where" keyword. Please suggest me. Thanks (2 Replies)
Discussion started by: sboss
2 Replies

8. Shell Programming and Scripting

Extended replacing of nonspecific strings in text files [beware complicated !]

Well, to make another post at this helpful forum :b::D: I recently tried something like this, I want to replace all those numberings/letters that are located between <string>file://localhost/var/mobile/Applications/ and /Documents/</string> numberings =---- replace with: first... (6 Replies)
Discussion started by: pasc
6 Replies

9. Shell Programming and Scripting

Search strings from array in second file

I have a file search_strings.txt filled with search strings which have a blank in between and look like this: S. g. Erh. o. J. v. d. Chijs g. Ehr.I would like to search the strings in the second given Textfile.txt and it shall return the column number. Can anybody help with the correct... (3 Replies)
Discussion started by: sdf
3 Replies

10. 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
Bio::PopGen::Simulation::GeneticDrift(3pm)		User Contributed Perl Documentation		Bio::PopGen::Simulation::GeneticDrift(3pm)

NAME
Bio::PopGen::Simulation::GeneticDrift - A simple genetic drift simulation SYNOPSIS
use Bio::PopGen::Simulation::GeneticDrift; my $sim = Bio::PopGen::Simulation::GeneticDrift->new(-popsize => 40, -alleles => {A => 0.2, B => 0.8}); for(my $i =0 ;$i < 10; $i++ ) { my %f = $sim->next_generation; # get the freqs for each generation } for(my $i =0 ;$i < 10; $i++ ) { # get the allele freqs as part of a Bio::PopGen::Population object my $pop = $sim->next_generation('population'); } DESCRIPTION
A very simple 1 locus multi-allele random drift module, start with an initial set of allele frequency and simulate what happens over time. This isn't really useful for anything in particular yet but will be built upon. See Gillespie JH.(1998) "Population Genetics: a Concise guide." The Johns Hopkins University Press, Baltimore, USA. pp.19-47. 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 the Bioperl mailing list. 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 of the bugs and their resolution. Bug reports can be submitted via email or the web: https://redmine.open-bio.org/projects/bioperl/ AUTHOR - Jason Stajich Email jason-at-bioperl-dot-org APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ new Title : new Usage : my $obj = Bio::PopGen::Simulation::GeneticDrift->new(); Function: Builds a new Bio::PopGen::Simulation::GeneticDrift object Returns : an instance of Bio::PopGen::Simulation::GeneticDrift Args : -popsize => starting N -haploid => boolean if we should simulate haploids -alleles => arrayref of the allele names OR -population => L<Bio::PopGen::PopulationI> object to initialize from some previously defined Population object (or result from a previous simulation) next_generation Title : next_generation Usage : my %generation = $sim->next_generation Function: Get the next generation of allele frequencies based on the current generation Returns : Hash of allele frequencies Args : 'allelefreqs' or 'population' to get back a hash of allele frequencies (default) OR a L<Bio::PopGen::Population> object population_size Title : population_size Usage : $obj->population_size($newval) Function: Example : Returns : value of population_size (a scalar) Args : on set, new value (a scalar or undef, optional) set_Frequencies_Equivalent Title : set_Frequencies_Equivalent Usage : $sim->set_Frequencies_Equivalent Function: Reset the allele frequencies so they are all even Returns : none Args : none get_Allele_Frequencies Title : get_Allele_Frequencies Usage : my %allele_freqs = $marker->get_Allele_Frequencies; Function: Get the alleles and their frequency (set relative to a given population - you may want to create different markers with the same name for different populations with this current implementation Returns : Associative array where keys are the names of the alleles Args : none add_Allele_Frequency Title : add_Allele_Frequency Usage : $marker->add_Allele_Frequency($allele,$freq) Function: Adds an allele frequency Returns : None Args : $allele - allele name $freq - frequency value reset_alleles Title : reset_alleles Usage : $marker->reset_alleles(); Function: Reset the alleles for a marker Returns : None Args : None validate_Frequencies Title : validate_Frequencies Usage : if( $sim->validate_Frequencies) {} Function: Sanity checker that allele frequencies sum to 1 or less Returns : boolean Args : -strict => 1 boolean if you want to insure that sum of freqs is 1 perl v5.14.2 2012-03-02 Bio::PopGen::Simulation::GeneticDrift(3pm)
All times are GMT -4. The time now is 01:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy