Sponsored Content
Top Forums Shell Programming and Scripting Grep multiple strings in a file Post 302883114 by Akshay Hegde on Friday 10th of January 2014 11:59:45 PM
Old 01-11-2014
Code:
$ cat <<test | awk '/Today/ && /Working/' 
Today is Sunday and Holiday for all
Today is Monday and Working day for all
Tomorrow will be Tuesday and Working day 
test

Today is Monday and Working day for all

Code:
$ cat <<test | grep  'Today.*Working'
Today is Sunday and Holiday for all
Today is Monday and Working day for all
Tomorrow will be Tuesday and Working day 
test

Today is Monday and Working day for all

 

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

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

4. 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

5. 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

6. 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

7. Shell Programming and Scripting

Can't grep multiple strings

I have a script that periodically checks the Apache error_log to search for a specific error that causes it to hand and, if found, it restarts the service. I recently found another error that forces it to hand and won't serve pages until it is reset. What I'm trying to do is to get the script to... (3 Replies)
Discussion started by: cfjohnsn
3 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 and replace multiple strings in a file with multiple filenames in a file

Hi, I have a file containing list of strings like i: Pink Yellow Green and I have file having list of file names in a directory j : a b c d Where j contains of a ,b,c,d are as follows a: Pink (3 Replies)
Discussion started by: madabhg
3 Replies

10. UNIX for Beginners Questions & Answers

How to pass strings from a list of strings from another file and create multiple files?

Hello Everyone , Iam a newbie to shell programming and iam reaching out if anyone can help in this :- I have two files 1) Insert.txt 2) partition_list.txt insert.txt looks like this :- insert into emp1 partition (partition_name) (a1, b2, c4, s6, d8) select a1, b2, c4, (2 Replies)
Discussion started by: nubie2linux
2 Replies
GTIMER(1)							      GTimer								 GTIMER(1)

NAME
gtimer - an application for recording time spent on user-defined tasks. SYNOPSIS
gtimer [-midnight offset] [-weekstart day] [-nosplash] [-resume] [-start task] DESCRIPTION
GTimer allows the user to time one or more activities. Users define tasks that can be timed. Text annotations can also be added to tasks. Reports can be generated that summarize time spent and annotations. OPTIONS
-midnight offset Specify the offset of midnight to use. Users can allow time spent after midnight to be recorded for the previous day. For exam- ple, the command gtimer -midnight 400 will not consider everything 3:59AM the previous day. -weekstart day Specify which day of the week should be considered the beginning of the week when generating reports. day should be a number between 0 and 6, where 0 is Sunday. For example, the command gtimer -weekstart 1 will use Monday as the first day of the week for all weekly reports. The default is 0 (Sunday). -resume Start timing any tasks that were still be timed when GTimer last exited. -start taskname Start timing the specified task immediately. This option can be used more than once on the command line. For example, you can start a tasks with: gtimer -start 'GTimer development' -nosplash Do not display the splash window on startup. FILES
~/.gtimer/ data storage SEE ALSO
enscript(1), lpr(1) AUTHOR
Craig Knudsen <cknudsen@cknudsen.com> <http://www.cknudsen.com/> GTimer WWW home page: <http://www.cknudsen.com/gtimer/> GTimer Mar 19, 2003 GTIMER(1)
All times are GMT -4. The time now is 01:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy