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
KinoSearch1::Search::BooleanQuery(3pm)			User Contributed Perl Documentation		    KinoSearch1::Search::BooleanQuery(3pm)

NAME
KinoSearch1::Search::BooleanQuery - match boolean combinations of Queries SYNOPSIS
my $bool_query = KinoSearch1::Search::BooleanQuery->new; $bool_query->add_clause( query => $term_query, occur => 'MUST' ); my $hits = $searcher->search( query => $bool_query ); DESCRIPTION
BooleanQueries are super-Query objects which match boolean combinations of other Queries. One way of producing a BooleanQuery is to feed a query string along the lines of "this AND NOT that" to a QueryParser object: my $bool_query = $query_parser->parse( 'this AND NOT that' ); It's also possible to achieve the same end by manually constructing the query piece by piece: my $bool_query = KinoSearch1::Search::BooleanQuery->new; my $this_query = KinoSearch1::Search::TermQuery->new( term => KinoSearch1::Index::Term->new( 'bodytext', 'this' ), ); $bool_query->add_clause( query => $this_query, occur => 'MUST' ); my $that_query = KinoSearch1::Search::TermQuery->new( term => KinoSearch1::Index::Term->new( 'bodytext', 'that' ), ); $bool_query->add_clause( query => $that_query, occur => 'MUST_NOT' ); QueryParser objects and hand-rolled Queries can work together: my $general_query = $query_parser->parse($q); my $news_only = KinoSearch1::Search::TermQuery->new( term => KinoSearch1::Index::Term->new( 'category', 'news' ); ); $bool_query->add_clause( query => $general_query, occur => 'MUST' ); $bool_query->add_clause( query => $news_only, occur => 'MUST' ); METHODS
new my $bool_query = KinoSearch1::Search::BooleanQuery->new; Constructor. Takes no arguments. add_clause $bool_query->add_clause( query => $query, # required occur => 'MUST', # default: 'SHOULD' ); Add a clause to the BooleanQuery. Takes hash-style parameters: o query - an object which belongs to a subclass of KinoSearch1::Search::Query. o occur - must be one of three possible values: 'SHOULD', 'MUST', or 'MUST_NOT'. COPYRIGHT
Copyright 2005-2010 Marvin Humphrey LICENSE, DISCLAIMER, BUGS, etc. See KinoSearch1 version 1.00. perl v5.14.2 2011-11-15 KinoSearch1::Search::BooleanQuery(3pm)
All times are GMT -4. The time now is 11:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy