06-29-2010
Script to search a large file with a list of terms in another file
Hi-
I am trying to search a large file with a number of different search terms that are listed one per line in 3 different files. Most importantly I need to be able to do a case insensitive search.
I have tried just using egrep -f but it doesn't seam to be able to handle the -i option when selecting a file for the search terms.
Any suggestions?
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
How do I search through a file that is so large (over 1GB) and find out exactly on what the exact pattern is found. I've used grep and know the line exist but what it returns is not complete because there are blobs in the data and there are control characters, etc and part of the data may beyond... (2 Replies)
Discussion started by: giannicello
2 Replies
2. Shell Programming and Scripting
Hi,
I have a requirement to search for a string in a large log file along with few lines before and after the the string. The following script was sufficient to search such an entry.
STRING_TO_GREP="$1"
FILE_TO_GREP="$2"
NUMBER_OF_LINES_BEFORE=$3
NUMBER_OF_LINES_AFTER=$4
for i in `grep... (3 Replies)
Discussion started by: praveen123
3 Replies
3. Shell Programming and Scripting
I have a file 1.txt with the below contents.
-----cat 1.txt-----
1234
5678
1256
1234
1247
-------------------
I have 3 more files in a folder
-----ls -lrt-------
A1.txt
A2.txt
A3.txt
-------------------
The contents of those three files are similar format with different data values... (8 Replies)
Discussion started by: realspirituals
8 Replies
4. Shell Programming and Scripting
I have a file that is a sort library in the format:
##def title1
content1
stuff1
content2
stuff2
##enddef
##def title2
etc..
I want to grep def and content and pull some trailing context from content
so the result would look something like: (1 Reply)
Discussion started by: Moe.Wilensky
1 Replies
5. Shell Programming and Scripting
Hello,
I have a very large file of around 2 million records which has the following structure:
I have used the standard awk program to sort:
# wordfreq.awk --- print list of word frequencies
{
# remove punctuation
#gsub(/_]/, "", $0)
for (i = 1; i <= NF; i++)
freq++
}
END {
for (word... (3 Replies)
Discussion started by: gimley
3 Replies
6. Shell Programming and Scripting
Hi everybody
I have a .txt file that contains some assembly code for optimizing it i need to remove some replicated parts.
for example I have:e_li r0,-1
e_li r25,-1
e_lis r25,0000
add r31, r31 ,r0
e_li r28,-1
e_lis r28,0000
add r31, r31 ,r0
e_li r28,-1 ... (3 Replies)
Discussion started by: Behrouzx77
3 Replies
7. UNIX for Dummies Questions & Answers
I have a flat file that looks like this, let's call it Chromosome_9.txt:
FT /Gene_Name="Guanyl-Acetylase 9"
FT /Gene_Number"36952"
FT /Gene_Name="Endoplasmic Luciferase"
FT /Gene_Number"36953"
FT ... (4 Replies)
Discussion started by: Twinklefingers
4 Replies
8. UNIX for Dummies Questions & Answers
(1 Reply)
Discussion started by: Twinklefingers
1 Replies
9. UNIX for Dummies Questions & Answers
I'm trying to find a way to search a range of similar words in a file. I tried using sed but can't get it right:sed 's/\(ca01\)*//'It only removes "ca01" but leaves the rest of the word. I still want the rest of the information on the lines just not these specific words listed below. Any... (3 Replies)
Discussion started by: seekryts15
3 Replies
10. UNIX for Beginners Questions & Answers
i have a file having 5 columns with more than million records. And i want to search using UNIX command to find if there are any spaces in 5th column. any please help. (1 Reply)
Discussion started by: sivakumar.p
1 Replies
LEARN ABOUT SUNOS
search.h
search.h(3HEAD) Headers search.h(3HEAD)
NAME
search.h, search - search tables
SYNOPSIS
#include <search.h>
DESCRIPTION
The <search.h> header defines the ENTRY type for structure entry, which includes the following members:
char *key
void *data
and defines ACTION and VISIT as enumeration data types through type definitions as follows:
enum { FIND, ENTER } ACTION;
enum { preorder, postorder, endorder, leaf } VISIT;
The size_t type is defined as described in <sys/types.h>. See types.h(3HEAD).
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
SEE ALSO
hsearch(3C), insque(3C), lsearch(3C), tsearch(3C), types.h(3HEAD), attributes(5), standards(5)
SunOS 5.10 10 Sep 2004 search.h(3HEAD)