problem with grep on search string in a txt file over multiple files


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers problem with grep on search string in a txt file over multiple files
# 1  
Old 05-17-2008
problem with grep on search string in a txt file over multiple files

I have a couple of things I got stuck on

1)
I have a text file containing 25k search string that I need to search against compressed file. I have used this command but somehow it doesn't seems to use all the search terms.

I have put one search string per line in the txt file (I clean up the domain name down to just the word ie abc.com to abc).

I have used zgrep --colour=always -nf [name of txt file] name of compressed file


2)
With the same text file 1) , I need to search against a folder containing 50k email messages (.eml format). If the .eml file contains match search string, it will move to another folder. So I can run a batch print later on.


I have both type of email message file, 1) one single file containing multiple messages and 2) 50000 individual email message in .eml format.

The problem with the search, it doesn't seem to run all the search string contains in the txt file against the target file. It seems only a few lines of search string is used.

Thanks in advance for any tips.
# 2  
Old 05-18-2008
A 25k long search string? Is your text so similar that you need to search 25000 characters to be sure of a match. Assuming the regex engine can even deal with that, the search efficiency is going to be pretty poor.

Or do you mean 25000 different strings? That has problems as well.

I think, rather than you tell us how you think it should be done, give us the problem you are trying to solve - in detail. This whole thing sounds wrong from the start, as I read it.

There are a lot of other tools out there like comm for example.
# 3  
Old 05-18-2008
No duplicate or cross-posting, please read the rules.

This thread is similar to:

https://www.unix.com/unix-dummies-que...5564-help.html

Thread closed.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to use a grep search to search for a specific string within multiple directories?

Lets say I have a massive directory which is filled with other directories all filled with different c++ scripts and I want a listing of all the scripts that contain the string: "this string". Is there a way to use a grep search for that? I tried: grep -lr "this string" * but I do not... (3 Replies)
Discussion started by: Circuits
3 Replies

2. Shell Programming and Scripting

Search string in multiple files and display column wise

I have 3 files. Each of those files have the same number of records, however certain records have different values. I would like to grep the field in ALL 3 files and display the output with only the differences in column wise and if possible line number File1 Name = Joe Age = 33... (3 Replies)
Discussion started by: sidnow
3 Replies

3. Shell Programming and Scripting

To search multiple string in file

hi , i am having a file where i need to take ignore the data from file1.txt and redirect to another file for eg: file1.txt AUS USA file2.txt AUS,123 NZ,11 USA,12 i am using the below code (4 Replies)
Discussion started by: rohit_shinez
4 Replies

4. Shell Programming and Scripting

Search text file, then grep next instance of string

I need to be able to search for a beginning line header, then use grep or something else to get the very next instance of a particular string, which will ALWAYS be in "Line5". What I have is some data that appears like this: Line1 Line2 Line3 Line4 Line5 Line6 Line7 Line1 Line2 ...... (4 Replies)
Discussion started by: Akilleez
4 Replies

5. Shell Programming and Scripting

replace a string with contents of a txt file containing multiple lines of strings

Hello everyone, ive been trying to replace a string "kw01" in an xml file with the contents of a txt file having multiple lines. im a unix newbie and all the sed combinations i tried resulted to being garbled. Below is the contents of the txt file: RAISEDATTIME --------------------... (13 Replies)
Discussion started by: 4dirk1
13 Replies

6. Shell Programming and Scripting

String search and replace in multiple files.

Hello. I have five config files in /etc that I want to edit in one click for testing. I would like to make a script like this : #!/bin/bash # a_file="/etc/file_1" src_str="src_string_1" rpl_str="rpl_string_1" calling_sed_or_awk_or_whatelse $a_file search_for_all $src_str replace_with... (4 Replies)
Discussion started by: jcdole
4 Replies

7. Shell Programming and Scripting

Search multiple strings on a file and copy the string next to it

I tried awk for this, but failed <or my code is not correct? I dont know>. Can anyone help me on this? ---------- Post updated at 08:34 PM ---------- Previous update was at 08:29 PM ---------- my working file looks like this: <empty> <empty> <empty> NAME :ABC AGE :15 GENDER... (6 Replies)
Discussion started by: kingpeejay
6 Replies

8. Shell Programming and Scripting

Multiple search string in multiple files using awk

Hi, filenames: contains name of list of files to search in. placelist contains the names of places to be searched in all files in "filenames" for i in $(<filenames) do egrep -f placelist $i if ] then echo $i fi done >> outputfile Output i am getting: (0 Replies)
Discussion started by: pinnacle
0 Replies

9. UNIX for Dummies Questions & Answers

grep/cat/more -- search in a txt file and display content from a specific "keyword"

Hi, I have a .txt file Sample: ===================== NEXT HOST ===================== AEADBAS001 ip access-list extended BLA_Incoming_Filter ip access-list extended BLA_Outgoing_Filter access-list 1 permit xxxxxxxxxxxxxx access-list 2 permit xxxxxxxxxxxxxx =====================... (4 Replies)
Discussion started by: I-1
4 Replies

10. UNIX for Dummies Questions & Answers

string search in folders with particular multiple file extension

Hi, I am newbie in UNIX so please excuse for my questions. Is there a a way to search for string in files within folder and sub folder in particluar file extensions. Ex. search for ABC in folder 'A'(including it's sub folders) in html, xml files. Thanks, Ani (2 Replies)
Discussion started by: anikanch
2 Replies
Login or Register to Ask a Question