Sponsored Content
Full Discussion: How to search file content
Operating Systems Linux How to search file content Post 302218752 by Franklin52 on Saturday 26th of July 2008 10:10:28 AM
Old 07-26-2008
Use grep:

Code:
grep [option] pattern [file]

Have a read of the manpage for the options.

Regards
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

shell script to search content of file with timestamps in the directory

hello, i want to make a script to search the file contents in my home directory by a given date and output me the line that has the date... (10 Replies)
Discussion started by: psychobeauty
10 Replies

2. UNIX for Advanced & Expert Users

Search files with specfic extention and later search content

Hi, I would appriciate if somebody can help me figure out how to search for all the *.xml file under a specific directory and subdirectroies (/home/username) and later search of content "<start>" inside the xml file returned by search. -Lovin.V (2 Replies)
Discussion started by: lovi_v
2 Replies

3. UNIX for Dummies Questions & Answers

Search File content.

Hi, I have a problem when searching a file, the file containt with the following: 95671660:Jones:Sarah:45:sales manager 93272658:Smith:John:43:technical manager 98781987:Williams:Nick:35:computer officer 99893878:Brown:Sarah:12:electrician 95673456:Couch:David:26:chef... (3 Replies)
Discussion started by: elenatec
3 Replies

4. Shell Programming and Scripting

Perl search and replace file content.

I am not sure if this is doable. I am trying to open and print the content of the file by replacing all instances fo perl to PERL . This is my code but it is giving me the number count instead of the actual lines with changes. open (PERLHISTORY, 'sample.txt') or die "The file sample.txt could... (3 Replies)
Discussion started by: jxh461
3 Replies

5. Shell Programming and Scripting

Search for string in filename, not file content

How can I search for a string in a filename? For example, I want to know if a filename (not the file contents) contains the string "test". (3 Replies)
Discussion started by: daflore
3 Replies

6. UNIX for Dummies Questions & Answers

Using File Browser to search file content ...

Hello, I'm using rhel6. Using File Browser Nautilus 2.28.4 I could easily locate any file I'm interested in by it name. I'd like to use this File Browser to locate the file name based on it content e.g. based on some word in the text file. It doesn't work for me that way ... My question: does... (0 Replies)
Discussion started by: susja
0 Replies

7. Shell Programming and Scripting

Need to build Shell Script to search content of a text file into a folder consist several files

Have to read one file say sourcefile containing several words and having another folder containing several files. Now read the first word of Sourcefile & search it into the folder consisting sevral files, and create another file with result. We hhave to pick the filename of the file in which... (3 Replies)
Discussion started by: mukesh.baranwal
3 Replies

8. Shell Programming and Scripting

want to search some content of the file with specific to user

I have some users in one unix system and i want to search some files with specific to user and then i want to find some content inside that file so can u help me how we can implement it? File location is as below. /pools/home_unix/cmadireddy/work/models/model/ cmadireddy is user name. now... (6 Replies)
Discussion started by: lathigara
6 Replies

9. Shell Programming and Scripting

Searching the content of one file using the search key of another file

I have two files: file 1: hello.com neo.com,japan.com,example.com news.net xyz.com, telecom.net, highlands.net, software.com example2.com earth.net, abc.gov.uk file 2: neo.com example.com abc.gov.uk file 2 are the search keys to search in file 1 if any of the search key is... (3 Replies)
Discussion started by: csim_mohan
3 Replies

10. Shell Programming and Scripting

Search the specific content from the complex file

Hi, I have a file with complex data without delimiter, have requirement to fetch the specific record based on some charcters. here is my file data ... (12 Replies)
Discussion started by: Riverstone
12 Replies
Wiki::Toolkit::Search::Base(3pm)			User Contributed Perl Documentation			  Wiki::Toolkit::Search::Base(3pm)

NAME
Wiki::Toolkit::Search::Base - Base class for Wiki::Toolkit search plugins. SYNOPSIS
my $search = Wiki::Toolkit::Search::XXX->new( @args ); my %wombat_nodes = $search->search_nodes("wombat"); This class details the methods that need to be overridden by search plugins. METHODS
"new" my $search = Wiki::Toolkit::Search::XXX->new( @args ); Creates a new searcher. By default the arguments are just passed to "_init", so you may wish to override that instead. "search_nodes" # Find all the nodes which contain the word 'expert'. my %results = $search->search_nodes('expert'); Returns a (possibly empty) hash whose keys are the node names and whose values are the scores in some kind of relevance-scoring system I haven't entirely come up with yet. For OR searches, this could initially be the number of terms that appear in the node, perhaps. Defaults to AND searches (if $and_or is not supplied, or is anything other than "OR" or "or"). Searches are case-insensitive. "analyze" @terms = $self->analyze($string) Splits a string into a set of terms for indexing and searching. Typically this is done case-insensitively, splitting at word boundaries, and extracting words that contain at least 1 word characters. "fuzzy_title_match" $wiki->write_node( "King's Cross St Pancras", "A station." ); my %matches = $search->fuzzy_title_match( "Kings Cross St. Pancras" ); Returns a (possibly empty) hash whose keys are the node names and whose values are the scores in some kind of relevance-scoring system I haven't entirely come up with yet. Note that even if an exact match is found, any other similar enough matches will also be returned. However, any exact match is guaranteed to have the highest relevance score. The matching is done against "canonicalised" forms of the search string and the node titles in the database: stripping vowels, repeated letters and non-word characters, and lowercasing. "index_node" $search->index_node($node, $content); Indexes or reindexes the given node in the search engine indexes. You must supply both the node name and its content. canonicalise_title $fuzzy = $self->canonicalise_title( $ node); Returns the node title as suitable for fuzzy searching: with punctuation and spaces removes, vowels removed, and double letters squashed. "delete_node" $search->delete_node($node); Removes the given node from the search indexes. NOTE: It's up to you to make sure the node is removed from the backend store. Croaks on error. "supports_phrase_searches" if ( $search->supports_phrase_searches ) { return $search->search_nodes( '"fox in socks"' ); } Returns true if this search backend supports phrase searching, and false otherwise. "supports_fuzzy_searches" if ( $search->supports_fuzzy_searches ) { return $search->fuzzy_title_match("Kings Cross St Pancreas"); } Returns true if this search backend supports fuzzy title matching, and false otherwise. SEE ALSO
Wiki::Toolkit perl v5.14.2 2012-05-28 Wiki::Toolkit::Search::Base(3pm)
All times are GMT -4. The time now is 09:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy