01-19-2012
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...
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hi,
how to print a row which contains a perticular word in its third column using grep, cut,
or any thing else.
thanks (2 Replies)
Discussion started by: useless79
2 Replies
2. Shell Programming and Scripting
i have a file in this pattern
MATCH1 word1 IMAGE word3 word4
MATCH2 word1 word2 word3 word4
MATCH2 word1 word2 word3 word4
MATCH2 word1 word2 word3 word4
MATCH2 word1 word2 word3 word4
MATCH1 word1 IMAGE word3 word4
MATCH2 word1 word2 word3 word4
MATCH2 word1 word2 word3 word4
MATCH2 word1... (7 Replies)
Discussion started by: bangaram
7 Replies
3. UNIX for Dummies Questions & Answers
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)
Discussion started by: dashing201
11 Replies
4. Shell Programming and Scripting
Hi,
How to print last word of line?
#!/bin/bash
x1="This is Kiran"
echo "$x1"
how to print "Kiran" in new variable.i.e x2=kiran (7 Replies)
Discussion started by: kiran_j
7 Replies
5. UNIX for Dummies Questions & Answers
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)
Discussion started by: tmalik79
11 Replies
6. Shell Programming and Scripting
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)
Discussion started by: manasa_vs
3 Replies
7. Shell Programming and Scripting
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)
Discussion started by: arghadeep adity
1 Replies
8. Shell Programming and Scripting
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)
Discussion started by: siva83
5 Replies
9. Shell Programming and Scripting
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)
Discussion started by: raokl
4 Replies
10. Shell Programming and Scripting
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)
Discussion started by: Ramneekgupta91
9 Replies