Sponsored Content
Full Discussion: Grep using line command
Top Forums Shell Programming and Scripting Grep using line command Post 93096 by Perderabo on Thursday 15th of December 2005 11:53:57 AM
Old 12-15-2005
Put all 1000 strings to find in a file called targets. Then do:
grep -Ff targets /big/data/file
That's about the best you can do quickly. It will be just one pass through the big file. I'm not sure if grep can handle 1000 strings, this could be the only problem. Use the -F as I show, it is faster since no regular expressions are involved. Do a practice run with small files to be sure you have the syntax right.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

diffrent results between command line and scripted grep

When I type a command at the command line it supplies one result and the exact same command in a script egrep '^01|^02|^03|^04' file > fileout count = 29353 same count in the script yields a count of 23492 is there any reason this could be happening. (1 Reply)
Discussion started by: r1500
1 Replies

2. UNIX for Dummies Questions & Answers

grep line command

Hi, Can anyone translate in words what this line command does: ls *.fits | grep -v "Zero\|zero" > objlist Obviously ls *.fits means to list all the fits file, grep looks for a certain word, Zero is a certain fits file, and > objlist , created a list with certain items, but I am not sure what... (3 Replies)
Discussion started by: cosmologist
3 Replies

3. UNIX for Dummies Questions & Answers

Can grep command return word instead of complete line

Hi Is there any way GREP command can return word and not complete line. My file has following data: Hello Everyone I am NitinrajSrivastava Hi Friends Welcome VrajSrivastava I am using grep 'raj' which is returning me complete line.However I want only the word having keyword 'raj'. Required... (11 Replies)
Discussion started by: dashing201
11 Replies

4. Shell Programming and Scripting

fetch last line no form file which is match with specific pattern by grep command

Hi i have a file which have a pattern like this Nov 10 session closed Nov 10 Nov 9 08:14:27 EST5EDT 2010 on tty . Nov 10 Oct 19 02:14:21 EST5EDT 2010 on pts/tk . Nov 10 afrtetryytr Nov 10 session closed Nov 10 Nov 10 03:21:04 EST5EDT 2010 Dec 8 Nov 10 05:03:02 EST5EDT 2010 ... (13 Replies)
Discussion started by: Himanshu_soni
13 Replies

5. UNIX for Dummies Questions & Answers

grep command on a line from a file

Dear forum, Please excuse my ignorance. I have looked through various forum posts and tried various solutions but have not been able to solve my problem. File1.txt consist of a list of 100 names (one per line). File2.txt contains details for 1000 people (one per line), with the first field... (7 Replies)
Discussion started by: beginner0302
7 Replies

6. Shell Programming and Scripting

Command to grep a word and print the whole line splitted into many

Hi, I need to search a word in the java file. Assume the line in the java file is, (the line was splitted into 3 lines) 1.operationContext.sendFeedback(2.FeedbackType.ERROR, null, "Input is empty.", "Input Details: pr 3.ovide Valid pair(s): "+pairType); When i grep for the word... (6 Replies)
Discussion started by: tulasiram
6 Replies

7. Shell Programming and Scripting

grep command and last line

Hello Dear Friends I have a question about grep command when I type the command grep 'energy' mydata.txt it gives me energy= 5001 energy= 8500 energy= 5505 energy= 5506 however I only want to see the last line. How can I use the grep command to pick the last line of grep output. ... (9 Replies)
Discussion started by: rpf
9 Replies

8. Shell Programming and Scripting

sed command to grep multiple pattern present in single line and delete that line

here is what i want to achieve.. i have a file with below contents cat fileName blah blah blah . .DROP this REJECT that . --sport 7800 -j REJECT --reject-with icmp-port-unreachable --dport 7800 -j REJECT --reject-with icmp-port-unreachable . . . more blah blah blah --dport 3306... (14 Replies)
Discussion started by: vivek d r
14 Replies

9. Shell Programming and Scripting

Grep command to ignore line starting with hyphen

Hi, I want to read a file line by line and exclude the lines that are beginning with special characters. The below code is working fine except when the line starts with hyphen (-) in the file. for TEST in `cat $FILE | grep -E -v '#|/+' | awk '{FS=":"}NF > 0{print $1}'` do . . done How... (4 Replies)
Discussion started by: Srinraj Rao
4 Replies

10. UNIX for Beginners Questions & Answers

Grep command on multiple line

Hi All, I have some xml files and I need to find out all xml where one specific type of pattern is available.. Pattern 1 ========== <MAP TIMEOUT="" MODE="STANDALONE"> <COMMENT>without Any Mapping</COMMENT> </MAP> Pattern 2 ========== <MAP TIMEOUT="" MODE="STANDALONE"> ... (4 Replies)
Discussion started by: Baharul
4 Replies
XENTRACE_FORMAT(1)					      General Commands Manual						XENTRACE_FORMAT(1)

NAME
xentrace_format - pretty-print Xen trace data SYNOPSIS
xentrace_format [ DEFS-FILE ] DESCRIPTION
xentrace_format parses trace data in xentrace binary format from standard input and reformats it according to the rules in a file of defi- nitions (DEFS-FILE), printing to standard output. The rules in DEFS-FILE should have the format shown below: event_id whitespace format Each rule should start on a new line. The format string may include format specifiers, such as: %(cpu)d, %(tsc)d, %(event)d, %(1)d, %(2)d, %(3)d, %(4)d, %(5)d [ the `d' format specifier output in decimal, alternatively `x' will output in hexadecimal and `o' will output in octal ] These correspond to the CPU number, event ID, timestamp counter and the 5 data fields from the trace record. There should be one such rule for each type of event to be pretty-printed (events which do not have formatting rules are ignored). A sample format file for Xen's predefined trace events is available in the file tools/xentrace/formats in the Xen source tree. Depending on your system and the rate at which trace data is produced, this script may not be able to keep up with the output of xentrace if it is piped directly. In these circumstances you should have xentrace output to a file for processing off-line. AUTHOR
Mark A. Williamson <mark.a.williamson@intel.com> SEE ALSO
xentrace(8), xentrace_cpusplit(1) Xen domain 0 utils 11 May 2004 XENTRACE_FORMAT(1)
All times are GMT -4. The time now is 05:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy