grep's output is correct based on the regular expression...dont expect it to output multilines unless there are multiple "-e" switches on the command line or use another tool to extract that info...
Thanks for your Replies Yazu and Shamrock.
Yazu/Shamrock,
Actually my intention is, when we use grep command it will print Filename, line number and the whole line having the word it matches.
Along with that i want the next few lines which ends with ";" also.
For Ex: Suppose if am search for "showAndLogWarning" in all the files. my script is printing as below,
Script is :
and the output is,
When you see the above output, in line 214 it is incomplete when compared to line 144.
Please suggest me a command.
Thanks and Regards,
Tulasi Ram.Bora
Moderator's Comments:
How to use code tags when posting data and code samples.
Last edited by Franklin52; 01-19-2012 at 03:26 PM..
Reason: Please use code tags for data and code samples, thank you
Hello,
one step in a shell script i am writing, involves Grep command to search a regular expression in a line an only print the string after the match
an example line is below
/logs/GRAS/LGT/applogs/lgt-2016-08-24/2016-08-24.8.log.zip:2016-08-24 19:12:48,602 ERROR... (9 Replies)
Hello Forum Members,
I am trying to write a script for a requirement where i have to recursively search for a pattern and replace it with the new string in run time from user inputs
grep -ohr "]*.xyz.com]*" $HOME/source/group/ | sort | uniq > $HOME/output.txt
while read -r -u9 line;
... (4 Replies)
I need to fetch particular string from log file based on grep condition match.
Actual requirement is need to print the next word from the same line based on grep string condtion match.
File :Java.lanag.xyz......File copied completed : abc.txt
Ouput :abc.txt
I have used below... (5 Replies)
Hi,
here are few lines present in the logs. I want to grep on Error and print few lines before and after Error word is found
line1
Line2
Line3
Error
Line4
Line5
Line6
Line7
I want the output to be
Line2
Line3
Error
Line5 (1 Reply)
Hi
can we grep for a word and print the next word of the greped word?
ex:- create or replace function function_name
create function function_name
we should search for word "function" and output next word "function_name" from both lines. (3 Replies)
Hi,
I have gone through may posts and dint find exact solution for my requirement.
I have file which consists below data and same file have lot of other data.
<MAPPING DESCRIPTION ='' ISVALID ='YES' NAME='m_TASK_UPDATE' OBJECTVERSION ='1'>
<MAPPING DESCRIPTION ='' ISVALID ='NO'... (11 Replies)
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)