Sponsored Content
Full Discussion: Grep no results
Top Forums Shell Programming and Scripting Grep no results Post 302565178 by rangarasan on Monday 17th of October 2011 07:29:58 AM
Old 10-17-2011
BASH

Hi,

Try this one,

Code:
#! /usr/bin/bash
dir=`pwd`;
file=`echo -ne "$dir/file"`;
file1=`echo -ne "$dir/file1"`;
res=`fgrep -f $file -c $file1`;
if [ $res == 0 ];
then
echo "Pattern Not found";
else
echo "Pattern Found";
fi

Cheers,
RangaSmilie
This User Gave Thanks to rangarasan For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to refine results of grep -p

I need help to further reduce the output shown below. I want to be able to only return the paragraph where the 'Database alias' is exactly equal to DBIHP. I do not want the other paragraphs being shown below. $ echo $dbalias DBIHP $ db2 list db directory|grep -p 'Database alias ... (2 Replies)
Discussion started by: priceb
2 Replies

2. UNIX for Dummies Questions & Answers

Filter results through pipe with grep

ls -ltr | grep string How can I use regular expressions to filter the results provided even more. I am using the above command as a reference. (1 Reply)
Discussion started by: ckandreou
1 Replies

3. UNIX for Dummies Questions & Answers

List grep results

Hi I need to search for matching strings in a database and I want to print out all files that matches in "detail", which means that I want the output to contain datum of last saving. I only get the grep function tp print the actual file names which is not enough since the database is to large... (14 Replies)
Discussion started by: slire
14 Replies

4. UNIX for Dummies Questions & Answers

My ps -ef|grep command results are chopped off

On our one HP-UX 11i box, we have some very long paths defined. When I want to check on our user processes running, the resulting paths are chopped off. /xyz/abc/123/......./server/b is really a process running in the ..../server/bin directory. Is this a terminal problem or buffer length... (1 Reply)
Discussion started by: bsp18974
1 Replies

5. UNIX for Dummies Questions & Answers

Acting on results from a grep command

Hi, I am currently reading a tar file and searching for a particular word using grep e.g. Plane. At the moment, if a sentence is found with the word "Plane" the sentence itself is piped to another file. Here is the code i am using; for jar in 'cat jar_file.tar'; do tar -tvf... (3 Replies)
Discussion started by: crunchie
3 Replies

6. Shell Programming and Scripting

Adding grep'd results in a variable

Here is one I am baffled with; I have not used unix for a while and now that I am back it has been fun remembering and I have enjoyed it, for the most past. this is in ksh. I need to search in a file for the line with X1 and cut columns 20-25, put them into a variable, added them (dollar... (3 Replies)
Discussion started by: CougarMutt
3 Replies

7. UNIX for Dummies Questions & Answers

How to do ls -l on results of grep and find?

Hi, Am running the command below to search for files that contains a certain string. grep -il "shutdown" `find . -type f -mtime -1 -print` | grep "^./scripts/active" How do I get it to do a ls -l on the list of files? I tried doing ls -l `grep -il "shutdown" `find . -type f -mtime -1... (5 Replies)
Discussion started by: newbie_01
5 Replies

8. Shell Programming and Scripting

How to analyse results of grep

Hi all, I'm working with a peice of software that runs on Linux that allows planning trips in cars through maps. This software has different variations depending on the type of car, e.g. BMW, Audi, Hyundai, etc... Each variation has a dependency on common external components that are not... (1 Reply)
Discussion started by: emoshaya
1 Replies

9. Shell Programming and Scripting

How to concatenate grep results?

hi, let's say we have input in files test1.txt, test2.txt, text3.txt ... ... ... ('...' means more files & lines not just 'dots') test1.txt has: A B C D ... ... ... test2.txt has A B C D ... ... ... (4 Replies)
Discussion started by: msonoth
4 Replies

10. Shell Programming and Scripting

Cannot get results from grep command

Hi, i have a file hello.log which as several line that look like the below 2015-12-07 09:46:56 0:339 120.111.12.12 POST /helloWorld 2015-12-07 09:46:57 0:439 122.111.12.12 POST /helloWorld .... when i grep expecting to see results like the below. ... (6 Replies)
Discussion started by: mohtashims
6 Replies
NUMFMT_GET_PATTERN(3)							 1						     NUMFMT_GET_PATTERN(3)

NumberFormatter::getPattern - Get formatter pattern

	Object oriented style

SYNOPSIS
public string NumberFormatter::getPattern (void ) DESCRIPTION
Procedural style string numfmt_get_pattern (NumberFormatter $fmt) Extract pattern used by the formatter. PARAMETERS
o $fmt -NumberFormatter object. RETURN VALUES
Pattern string that is used by the formatter, or FALSE if an error happens. EXAMPLES
Example #1 numfmt_get_pattern(3) example <?php $fmt = numfmt_create( 'de_DE', NumberFormatter::DECIMAL ); echo "Pattern: ".numfmt_get_pattern($fmt)." "; echo numfmt_format($fmt, 1234567.891234567890000)." "; numfmt_set_pattern($fmt, "#0.# kg"); echo "Pattern: ".numfmt_get_pattern($fmt)." "; echo numfmt_format($fmt, 1234567.891234567890000)." "; ?> Example #2 OO example <?php $fmt = new NumberFormatter( 'de_DE', NumberFormatter::DECIMAL ); echo "Pattern: ".$fmt->getPattern()." "; echo $fmt->format(1234567.891234567890000)." "; $fmt->setPattern("#0.# kg"); echo "Pattern: ".$fmt->getPattern()." "; echo $fmt->format(1234567.891234567890000)." "; ?> The above example will output: Pattern: #,##0.### 1.234.567,891 Pattern: #0.# kg 1234567,9 kg SEE ALSO
numfmt_get_error_code(3), numfmt_set_pattern(3), numfmt_create(3). PHP Documentation Group NUMFMT_GET_PATTERN(3)
All times are GMT -4. The time now is 05:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy