Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Search and Parse string from inside a File Post 302144514 by SSims on Thursday 8th of November 2007 02:50:08 PM
Old 11-08-2007
Hi Jim,
Thanks for your feedback and valuable information.

Perhaps I should also add that I'm using the Borne Shell and now realize that I cannot use the
"For Do Done" loop.

I want to search a file for a value, then search if this value is contained in another file. For example: Parse 21909 from FileA.txt (e.g. 1234|3234|21909), then search within several other files for 21909 . If value exist, display file name and line number where this value exists. Then repeat parsing in FileA.txt for the next value 97909 (e.g. 5284|1134|97909), search 97909 within several other files and see if this values exist. If so, display file name and line number where this value exists.

Thanks again!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl: Search for string then parse next line

Hi All, I have a file that I need to be able to find a pattern match on one line then parse data on the next or subsequent lines - I will know which line needs to be parsed beforehand. This is what I currently have: while (<COMMAND_OUT>) { if ($_ =~ m/TEST/) { ... (4 Replies)
Discussion started by: pondlife
4 Replies

2. Shell Programming and Scripting

How to search a pattern inside a zipped file ie (.gz file) with out unzipping it

How to search a pattern inside a zipped file ie (.gz file) with out unzipping it? using grep command.. Bit urgent.. pls..help me (2 Replies)
Discussion started by: senraj01
2 Replies

3. Shell Programming and Scripting

Parse String in XML file

Hello All, I am new to this and I need to parse an XML file. Here's the XML Input File: <Report version="1.2"> <summary fatals="0" testcases="1" expected_fails="0" unexpected_passes="0" warnings="9" tests="21" errors="0" fails="1" passes="20" /> <testresult... (4 Replies)
Discussion started by: racbern
4 Replies

4. Shell Programming and Scripting

Search inside a Jar file..

Hey Guys, I need to search inside all the jar files of my directory for a specific string. Can anyone guide me as to how i can do it. I need this urgently please. More specifically i need to search for a class file name in the jar files. Thanks in advance :-) (4 Replies)
Discussion started by: srikumar_cs
4 Replies

5. Shell Programming and Scripting

Parse file from remote server to calculate count of string existence in that file

Hi I need to parse the file of same name which exist on different servers and calculate the count of string existed in both files. Say a file abc.log exist on 2 servers. I want to search for string "test" on both files and calculate the total count of search string's existence. For... (6 Replies)
Discussion started by: poweroflinux
6 Replies

6. Shell Programming and Scripting

Search string and parse

Input file 0792 to 2450 iadmssql7: Copy: CNJ R1: Replication volumes: Replication set: RSet 1 Replication size: 200.00GB SAN Info: 200.00GB DGC VRAID CX4-960 LUN 17 (17) RPA Port WWN Ctrl ... (0 Replies)
Discussion started by: greycells
0 Replies

7. Shell Programming and Scripting

Search inside a file, PERL

HEllo!! I need a script in perl that see inside a file(file.txt) that has only one row. The row contains only this text: logs_yearly = 20120628113345 I want that the script does this: "Search in the file, if the date 20120628 is actual date" Thank you!! ---------- Post... (4 Replies)
Discussion started by: super_sun
4 Replies

8. Shell Programming and Scripting

Urgent - Search a string inside awk

I need to search for string which is formed from the awk input file in a file given as input through -v option. I tried using the while (getline filename) and match(). But this approach is consuming lot of time as the input file has thousands of records. Please suggest any alternative. Thanks! (0 Replies)
Discussion started by: Cool
0 Replies

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

10. UNIX for Beginners Questions & Answers

Search a string inside a pattern matched block of a file

How to grep for searching a string within a begin and end pattern of a file. Sent from my Redmi 3S using Tapatalk (8 Replies)
Discussion started by: Baishali
8 Replies
Xapian::QueryParser(3pm)				User Contributed Perl Documentation				  Xapian::QueryParser(3pm)

NAME
Search::Xapian::QueryParser - Parse a query string into a Search::Xapian::Query object DESCRIPTION
This module turns a human readable string into something Xapian can understand. The syntax supported is designed to be similar to other web based search engines, so that users familiar with them don't have to learn a whole new syntax. SYNOPSIS
use Search::Xapian qw/:standard/; my $qp = new Search::Xapian::QueryParser( [$database] ); $qp->set_stemmer(new Search::Xapian::Stem("english")); $qp->set_default_op(OP_AND); $database->enquire($qp->parse_query('a NEAR word OR "a phrase" NOT (too difficult) +eh')); METHODS
new <database> QueryParser constructor. set_stemmer <stemmer> Set the Search::Xapian::Stem object to be used for stemming query terms. set_stemming_strategy <strategy> Set the stemming strategy. Valid values are "STEM_ALL", "STEM_SOME", "STEM_NONE". set_stopper <stopper> Set the Search::Xapian::Stopper object to be used for identifying stopwords. set_default_op <operator> Set the default operator. This operator is used to combine non-filter query items when no explicit operator is used. The most useful values for this are OP_OR (the default) and OP_AND. OP_NEAR and OP_PHRASE can also be useful. See Search::Xapian for descriptions of these constants. get_default_op Returns the current default operator. set_database <database> Pass a Search::Xapian::Database object which is used to check whether terms exist in some situations. parse_query <query_string> [<flags>] Parses the query string according to the rules defined in the query parser documentation below. You can specify certain flags to modify the searching behaviour: FLAG_BOOLEAN, FLAG_PHRASE, FLAG_LOVEHATE, FLAG_BOOLEAN_ANY_CASE, FLAG_WILDCARD, FLAG_PURE_NOT, FLAG_PARTIAL, FLAG_SPELLING_CORRECTION, FLAG_SYNONYM, FLAG_AUTO_SYNONYMS, FLAG_AUTO_MULTIWORD_SYNONYMS To specify multiple flags, "bitwise or" them together (with "|"). The default flags are "FLAG_PHRASE|FLAG_BOOLEAN|FLAG_LOVEHATE" add_prefix <field> <prefix> Add a probabilistic term prefix. E.g. $qp->add_prefix("author", "A"); Allows the user to search for author:orwell which will search for the term "Aorwel" (assuming English stemming is in use). Multiple fields can be mapped to the same prefix (so you can e.g. make title: and subject: aliases for each other). Parameters: field The user visible field name prefix The term prefix to map this to add_boolean_prefix <field> prefix Add a boolean term prefix allowing the user to restrict a search with a boolean filter specified in the free text query. E.g. $p->add_boolean_prefix("site", "H"); Allows the user to restrict a search with site:xapian.org which will be converted to Hxapian.org combined with any probabilistic query with "OP_FILTER". Multiple fields can be mapped to the same prefix (so you can e.g. make site: and domain: aliases for each other). Parameters: field The user visible field name prefix The term prefix to map this to stoplist_begin stoplist_end unstem_begin unstem_end get_description Returns a string describing this object. get_corrected_query_string Get the spelling-corrected query string. This will only be set if FLAG_SPELLING_CORRECTION is specified when QueryParser::parse_query() was last called. If there were no corrections, an empty string is returned. set_max_wildcard_expansion <limit> Specify the maximum expansion of a wildcard term. Note: you must also set FLAG_WILDCARD for wildcard expansion to happen. Parameter limit is the maximum number of terms each wildcard in the query can expand to, or 0 for no limit (which is the default). REFERENCE
http://www.xapian.org/docs/queryparser.html http://www.xapian.org/docs/sourcedoc/html/classXapian_1_1QueryParser.html perl v5.14.2 2012-05-09 Xapian::QueryParser(3pm)
All times are GMT -4. The time now is 02:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy