Sponsored Content
Top Forums Shell Programming and Scripting fuzzy sequence match in a text file Post 302700949 by hexram on Friday 14th of September 2012 12:45:00 PM
Old 09-14-2012
I don't follow the logic behind
Code:
if(skip != 0 || $2+0 == day + 2) skip=1

# or
if (skip == 0) {
    if ($2+0 == day + 2) skip =1
}

being equivalent... The first statement is "if ((skip is not 0) OR (($2+0) equals (day + 2)))", but your second expression is "if (skip equals 0) THEN if (($2+0) is equal to (day + 2))", and as such it is NOT equivalent to the first one; in the first statement it suffices that "(skip is not 0)" to make "skip=1", but in the second expression this is not true. As I see it, the second expression is equivalent to "if ((skip equals 0) AND (($2+0) equals (day + 2)))", which is clearly different from the first statement.
 

10 More Discussions You Might Find Interesting

1. Programming

Fuzzy Match Logic for Numerical Values

I have searched the internet (including these forums) and perhaps I'm not using the right wording. What I'm looking for is a function (preferably C) that analyzes the similitude of two numerical or near-numerical values, and returns either a true/false (match/nomatch) or a return code that... (4 Replies)
Discussion started by: marcus121
4 Replies

2. Shell Programming and Scripting

match text from two files and write to a third file

Hi all I have two files X.txt and Y.txt. Both file contains same number of sentences. The content of X.txt is The filter described above may be combined. and the content of Y.txt is The filter describ+ed above may be combin+ed. Some of the words are separated with "+"... (2 Replies)
Discussion started by: my_Perl
2 Replies

3. Shell Programming and Scripting

Insert text file only after the first match with SED

Hello, I'm new in Shell scripting but i should write a script, which inserts the license header out of a txt-File into the files in our Projekt. For the Java classes it runs without Problems but for XML files not. At xml-files i have to put the license Header after the xml-Header (?xml... (1 Reply)
Discussion started by: PhoenixONE
1 Replies

4. Shell Programming and Scripting

find common entries and match the number with long sequence and cut that sequence in output

Hi all, I have a file like this ID 3BP5L_HUMAN Reviewed; 393 AA. AC Q7L8J4; Q96FI5; Q9BQH8; Q9C0E3; DT 05-FEB-2008, integrated into UniProtKB/Swiss-Prot. DT 05-JUL-2004, sequence version 1. DT 05-SEP-2012, entry version 71. FT COILED 59 140 ... (1 Reply)
Discussion started by: manigrover
1 Replies

5. Shell Programming and Scripting

Inserting IDs from a text file into a sequence alignment file

Hi, I have one file with one column and several hundred entries File1: NA1 NA2 NA3And now I need to run a command within a mapping aligner tool to insert these sample names into a sequence alignment file (SAM) such that they look like this @RG ID:Library1 SM:NA1 PL:Illumina ... (7 Replies)
Discussion started by: nans
7 Replies

6. Shell Programming and Scripting

Match text from file 1 to file 2 and return specific text

I hope this makes sense and is possible. I am trying to match $1 of panel_genes.txt with $3 of RefSeqGene.txt and when a match is found the value in $6 of RefSeqGene.txt Example: ACTA2 is $1 of panel_genes.txt ACTA2 NM_001613.2 ACTA2 NM_001141945.1 awk 'FNR==NR {... (4 Replies)
Discussion started by: cmccabe
4 Replies

7. Shell Programming and Scripting

Display match or no match and write a text file to a directory

The below bash connects to a site, downloads a file, searches that file based of user input - could be multiple (all that seems to work). What I am not able to figure out is how to display on the screen match found or no match found" and write a file to a directory (C:\Users\cmccabe\Desktop\wget)... (4 Replies)
Discussion started by: cmccabe
4 Replies

8. Shell Programming and Scripting

Match all lines in file where specific text pattern is less than

In the below file I am trying to grep or similar, all lines where only AF= is less than 0.4.. Thank you :). grep grep "AF=" ,+ .4 file file 12 112036782 . T C 34.0248 PASS ... (3 Replies)
Discussion started by: cmccabe
3 Replies

9. Shell Programming and Scripting

Insert text after match in XML file

Having a little trouble getting this to work just right. I have xml files that i want to split some data. I have 2 <name> tags within the file I would like to take only the first tag and split the data. tag example. From this. TAB<Name>smith, john</Name> to TAB<Name>smith,... (8 Replies)
Discussion started by: whegra
8 Replies

10. Shell Programming and Scripting

Match text to lines in a file, iterate backwards until text or text substring matches, print to file

hi all, trying this using shell/bash with sed/awk/grep I have two files, one containing one column, the other containing multiple columns (comma delimited). file1.txt abc12345 def12345 ghi54321 ... file2.txt abc1,text1,texta abc,text2,textb def123,text3,textc gh,text4,textd... (6 Replies)
Discussion started by: shogun1970
6 Replies
HTML::Microformats::Utilities(3pm)			User Contributed Perl Documentation			HTML::Microformats::Utilities(3pm)

NAME
HTML::Microformats::Utilities - utility functions for searching and manipulating HTML DESCRIPTION
This module includes a few functions for searching and manipulating HTML trees. "searchClass($class, $node, [$prefix])" Returns a list of elements which are descendents of $node and have class name $class. $class can be a plain string, or a regular expression. If $prefix is supplied it is used as an optional prefix for $class. For example, with $class 'bar' and $prefix 'foo', searchClass will look for all of the following classes: 'bar', 'foobar', 'foo-bar' and 'foo:bar'. "searchAncestorClass($class, $node, [$skip])" Returns the first element which is an ancestor of $node having class name $class. $class can be a plain string, or a regular expression. $skip is the number of levels of ancestor to skip. If $skip is 0, then potentially searchAncestorClass will return $node itself. If $skip is 1, then it will not return $node but could potentially return its parent, and so on. "searchRel($relationship, $node)" Returns a list of elements which are descendents of $node and have relationship $relationship. $relationship can be a plain string, or a regular expression. "searchRev($relationship, $node)" As per searchRel, but uses the rev attribute. "searchID($id, $node)" Returns a descendent of $node with id attribute $id, or undef. "searchAncestorTag($tagname, $node)" Returns the nearest ancestor of $node with tag name $tagname, or undef. "stringify($node, \%options)" Returns a stringified version of a DOM element. This is conceptually equivalent to "$node->textContent", but follows microformat- specific stringification rules, including value excerption, the abbr pattern and so on. "xml_stringify($node)" Returns an XML serialisation of a DOM element. This is conceptually equivalent to "$node->toStringEC14N", but hides certain attributes which HTML::Microformats::DocumentContext adds for internal processing. BUGS
Please report any bugs to <http://rt.cpan.org/>. SEE ALSO
HTML::Microformats. AUTHOR
Toby Inkster <tobyink@cpan.org>. COPYRIGHT
Copyright 2008-2011 Toby Inkster This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. DISCLAIMER OF WARRANTIES
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. perl v5.14.2 2011-12-06 HTML::Microformats::Utilities(3pm)
All times are GMT -4. The time now is 07:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy