Sponsored Content
Full Discussion: Can't grep multiple strings
Top Forums Shell Programming and Scripting Can't grep multiple strings Post 302733695 by Jotne on Wednesday 21st of November 2012 12:53:40 AM
Old 11-21-2012
Uising awk

sting1 or string2
Code:
awk '/string1|string2/' file

sting1 and string2
Code:
awk '/string1/ && /string2/' file

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Efficient way to grep multiple strings

I have a script which searches a huge log file for the existence of a specified string and if the string is not present i receive an alert mail. Here's an extract: STRING=$(grep 'warning' logfile | tail -1 | wc -l) if (( ${STRING} > 0 )); then print -- "---- Warning etc.... (3 Replies)
Discussion started by: Moxy
3 Replies

2. Shell Programming and Scripting

Grep Multiple Strings

Hi, Can any one pelase tell me how to grep multiple strings from multiple files in a singel folder? grep -E "string1|string2|string3|string4|string..." its taking lots of time.. can any please tell me fast grep??? URGENT (10 Replies)
Discussion started by: durgaprasad
10 Replies

3. Shell Programming and Scripting

Count occurance of multiple strings using grep command

How to grep multiple string occurance in input file using single grep command? I have below input file with many IDP, RRBE messages. Out put should have count of each messages. I have used below command but it is not working grep -cH "(sent IDP Request)(Recv RRBCSM)" *.txt ... (5 Replies)
Discussion started by: sushmab82
5 Replies

4. Shell Programming and Scripting

How to get filename from the fullpath and how to grep multiple strings

Hi, New to shell scripting.... I have log file content as below: I have to count the number of occurences of ERROR or INFO Messages. So, I cut 5 th column and uniquly sorted and redirected it to new.txt file. But I want copy to S*/Filename and T*/Filename of respective ERROR or INFO... (5 Replies)
Discussion started by: Shirisha
5 Replies

5. UNIX for Dummies Questions & Answers

grep command to find multiple strings in multiple lines in a file.

I want to search files (basically .cc files) in /xx folder and subfolders. Those files (*.cc files) must contain #include "header.h" AND x() function. I am writing it another way to make it clear, I wanna list of *.cc files that have 'header.h' & 'x()'. They must have two strings, header.h... (2 Replies)
Discussion started by: ritikaSharma
2 Replies

6. UNIX for Dummies Questions & Answers

Grep multiple strings in multiple files using single command

Hi, I will use below command for grep single string ("osuser" is search string) ex: find . -type f | xarg grep -il osuser but i have one more string "v$session" here i want to grep in which file these two strings are present. any help is appreciated, Thanks in advance. Gagan (2 Replies)
Discussion started by: gagan4599
2 Replies

7. Shell Programming and Scripting

Grep multiple strings in multiple files

Hi, every one! I have a file with multiple strings. file1 ATQRGNE ASQGVKFTE ASSQYRDRGGLET SPEQGARSDE ASSRDFTDT ASSYSGGYE ASSYTRLWNTGE ASQGHNTD PSLGGGNQPQH SLDRDSYNEQF I want to grep each string in hundreds of files in the same directory, further, I want to find out the string... (7 Replies)
Discussion started by: xshang
7 Replies

8. Shell Programming and Scripting

Whether we can search multiple strings using or in grep -F

Hi, Whether we can search multiple strings using or in grep -F In Generally, grep -F "string1" "filename.txt" How to search for multiple string using grep -F as we using grep grep "string1\|string2" "filename.txt" Regards, Nanthagopal A (10 Replies)
Discussion started by: nanthagopal
10 Replies

9. Shell Programming and Scripting

Grep multiple strings in a file

Consider i have the below data in my log file. i want to grep using "Monday" and "Working" So the only output i expect is Can you help me with the grep query for Sun Sparc ? Usage: grep -hblcnsviw pattern file . . . (8 Replies)
Discussion started by: mohtashims
8 Replies

10. Shell Programming and Scripting

Grep for text between twp strings for multiple occurances.

I need to get text between two strings <app-deployment file=" and </app-deployment> as it appears more than once in the file then how can i store the text between each occurrence in a separate file ? Thus, i need the below to go in found1.tmp and the below to go in found2.tmp ... (8 Replies)
Discussion started by: mohtashims
8 Replies
ERROR_LOG(3)								 1							      ERROR_LOG(3)

error_log - Send an error message to the defined error handling routines

SYNOPSIS
bool error_log (string $message, [int $message_type], [string $destination], [string $extra_headers]) DESCRIPTION
Sends an error message to the web server's error log or to a file. PARAMETERS
o $message - The error message that should be logged. o $message_type - Says where the error should go. The possible message types are as follows: error_log(3) log types +--+---------------------------------------------------+ |0 | | | | | | | $message is sent to PHP's system logger, using | | | the Operating System's system logging mechanism | | | or a file, depending on what the error_log con- | | | figuration directive is set to. This is the | | | default option. | | | | |1 | | | | | | | $message is sent by email to the address in the | | | $destination parameter. This is the only message | | | type where the fourth parameter, $extra_headers | | | is used. | | | | |2 | | | | | | | No longer an option. | | | | |3 | | | | | | | $message is appended to the file $destination. A | | | newline is not automatically added to the end of | | | the $message string. | | | | |4 | | | | | | | $message is sent directly to the SAPI logging | | | handler. | | | | +--+---------------------------------------------------+ o $destination - The destination. Its meaning depends on the $message_type parameter as described above. o $extra_headers - The extra headers. It's used when the $message_type parameter is set to 1. This message type uses the same internal function as mail(3) does. RETURN VALUES
Returns TRUE on success or FALSE on failure. NOTES
Warning error_log(3) is not binary safe. $message will be truncated by null character. Tip $message should not contain null character. Note that $message may be sent to file, mail, syslog, etc. Use appropriate conver- sion/escape function, base64_encode(3), rawurlencode(3) or addslashes(3) before calling error_log(3). EXAMPLES
Example #1 error_log(3) examples <?php // Send notification through the server log if we can not // connect to the database. if (!Ora_Logon($username, $password)) { error_log("Oracle database not available!", 0); } // Notify administrator by email if we run out of FOO if (!($foo = allocate_new_foo())) { error_log("Big trouble, we're all out of FOOs!", 1, "operator@example.com"); } // another way to call error_log(): error_log("You messed up!", 3, "/var/tmp/my-errors.log"); ?> CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.2.7 | | | | | | | The possible value of 4 was added to $mes- | | | sage_type. | | | | +--------+---------------------------------------------------+ PHP Documentation Group ERROR_LOG(3)
All times are GMT -4. The time now is 12:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy