Sponsored Content
Top Forums Shell Programming and Scripting egrep output each file in new line Post 302398842 by konddor on Thursday 25th of February 2010 06:42:23 PM
Old 02-25-2010
egrep output each file in new line

I have the following script that searches in several files and shows the search results and the matches filename on the screen.

Code:
find . -exec egrep -wH "word1|word2" {} \;

the output from the search display as:
Code:
file1
word1
word2

I need to show each file search output result on new line.
for instance:
Code:
file1:word1:word2

some of the files missing both string of the search query or having blank spaces between words,

Anyone know how I can get each file search results on new line?

Thanks

Last edited by Scott; 02-25-2010 at 07:51 PM.. Reason: Please use code tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

adding blank line in egrep

I followed the egrep example given in the thread "parse text or complex grep ?". It is exactly what I need...except... how do I insert a blank line after the second line? My exact command is: egrep 'patt1|patt2' filename the result is: patt1 patt2 patt1 patt2 and so on. I would... (2 Replies)
Discussion started by: antalexi
2 Replies

2. Shell Programming and Scripting

Comma Delimited Output w/ egrep

Hi all, I have an input file that I am pulling out certain phases using the following commands: cat /nodes.txt | egrep -e 'OSVersion|PrimaryNodeName' Currently the output looks like this: OSVersion - 5.0 PrimaryNodeName - serverA OSVersion - 5.0 PrimaryNodeName - serverB OSVersion... (2 Replies)
Discussion started by: indianadoug
2 Replies

3. Shell Programming and Scripting

egrep problem | printing next line?????

Hi !!! Dear People, Please help me with the following problem. consider this output: Top 5 Timed Events ~~~~~~~~~~~~ Total Event Waits Time (s) Ela Time ---------------------------- ------------ ----------- ----- CPU time ... (3 Replies)
Discussion started by: user__user3110
3 Replies

4. Shell Programming and Scripting

How to grep/awk/egrep two values for given output?

Dear Friends, I have a command which can result following output. Packet is: /var/adm/yyyy/pkt6043 Intended for network : /vob/repo I would like to retrive pkt6043 and /vob/repo using single command. Blue color test will be always contstant and red color text will be dynamic ... (2 Replies)
Discussion started by: baluchen
2 Replies

5. UNIX for Dummies Questions & Answers

egrep line which begging with

HI Guys, I want egrep from ./txt file which begging from Hello. File A.txt Hello A Abc Abc Xyz Hello B Hello C .. ... Output File B Hello A Hello B (2 Replies)
Discussion started by: asavaliya
2 Replies

6. Shell Programming and Scripting

egrep output order

The order of egrep output seems to be as they occur in the file. How do I get the order as requested? For e.g. file contents: AAA EEE GGG egrep 'GGG|AAA|EEE' file gives AAA EEE GGG instead of GGG AAA EEE (2 Replies)
Discussion started by: madhavb
2 Replies

7. Shell Programming and Scripting

Using egrep to output expressions which are not found

Hi, Im using the below command to search a file for multiple expressions if the 4th expression doesnt exist the command simply lists what it can find and ignores what it cant. Is there any way to get the command to output an error or a message if it cant find the 4th expression to a file? ... (16 Replies)
Discussion started by: 02JayJay02
16 Replies

8. Shell Programming and Scripting

sed command to replace a line in a file using line number from the output of a pipe.

Sed command to replace a line in a file using line number from the output of a pipe. Is it possible to replace a whole line piped from someother command into a file at paritcular line... here is some basic execution flow.. the line number is 412 lineNo=412 Now i have a line... (1 Reply)
Discussion started by: vivek d r
1 Replies

9. UNIX for Dummies Questions & Answers

Egrep output

If I have an output from egrep that has two elements on separate lines can I concatenate them? so the egrep for examople might be: egrep "filename|type" And the actual output might be: ./file001.doc Type Text Document How do I get the egrep to remove the line feed so the output is: ... (5 Replies)
Discussion started by: TuftyDave
5 Replies

10. UNIX for Beginners Questions & Answers

Output to file print as single line, not separate line

example of problem: when I echo "$e" >> /home/cogiz/file.txt result prints to file as:AA BB CC I need it to save to file as this:AA BB CC I know it's probably something really simple but any help would be greatly appreciated. Thank You. Cogiz (7 Replies)
Discussion started by: cogiz
7 Replies
SWISH-E(1)						       SWISH-E Documentation							SWISH-E(1)

NAME
Swish-e - A Search Engine SYNOPSIS
swish [-e] [-i dir file ... ] [-S system] [-c file] [-f file] [-l] [-v (num)] swish -w word1 word2 ... [-f file1 file2 ...] [-P phrase_delimiter] [-p prop1 ...] [-s sortprop1 [asc|desc] ...] [-m num] [-t str] [-d delim] [-H (num)] [-x output_format] swish -k (char|*) [-f file1 file2 ...] swish -M index1 index2 ... outputfile swish -N /path/to/compare/file swish -V See the the SWISH-RUN(1) man page for details on run-time options. DESCRIPTION
Swish-e is Simple Web Indexing System for Humans - Enhanced. Swish-e can quickly and easily index directories of files or remote web sites and search the generated indexes. Swish-e is extremely fast in both indexing and searching, highly configurable, and can be seamlessly integrated with existing web sites to maintain a consistent design. Swish-e can index web pages, but can just as easily index text files, mailing list archives, or data stored in a relational database. Swish is designed to index small to medium sized collection of documents, Although a few users are indexing over a million documents, typi- cal usage is more often in the tens of thousands. Currently, Swish-e only indexes eight bit character encodings. DOCUMENTATION
Documentation is provided as HTML pages installed in $prefix/share/doc/swish-e where $prefix is /usr/local if building from source, or /usr if installed as part of a package from your OS vendor. Under Windows $prefix is selected at installation time. Documentation is also available on-line at http://swish-e.org. A subset of the documentation is installed as system man pages as well. The following man pages should be installed: swish-e(1) This man page. SWISH-CONFIG(1) Defines options that can be used in a configuration file. SWISH-RUN(1) Describes the run-time options and switches. SWISH-FAQ(1) Answers to commonly asked questions. SWISH-LIBRARY(1) API for the Swish-e search library. Applications can link against this library. SUPPORT
Support for Swish-e is provide via the Swish-e discussion list. See http://swish-e.org for information. 2.4.7 2009-04-04 SWISH-E(1)
All times are GMT -4. The time now is 11:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy