How to grep word + next line in solaris 10?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to grep word + next line in solaris 10?
# 1  
Old 07-01-2009
How to grep word + next line in solaris 10?

Hi my unix friends,
How do I grep a word and next line with solaris 10.

tnx
Mehrdad

---------- Post updated at 03:17 PM ---------- Previous update was at 03:09 PM ----------

I found this one:

cat <file_name> | awk '/<seek_word>/ {print;getline;print}'
# 2  
Old 07-01-2009
that command is good, but I think you may need to use nawk instead of awk on solaris.

Last edited by rakeshawasthi; 07-01-2009 at 10:34 AM..
# 3  
Old 07-01-2009
Hello!

Per forum rules, and the benefit of all users, please search the forums before posting a question.

You can easily search the forums using our internal Google search engine or our advanced internal search engine. You can also search our huge UNIX and Linux database by user generated tags or search the database for unanswered questions and provide an answer.

Thank you.

The UNIX and Linux Forums
# 4  
Old 07-01-2009
Will do.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Write a script for getout afew line and grep a define word

dear all Hi i want write a script can count number of my log file and every 5min run script for cgk log file for find a specific word such as Error for example in first 5 min we have 500 line in my log file and in second 5min we have 2500 line in my log file how can chk error word in my log... (4 Replies)
Discussion started by: Baber
4 Replies

2. Shell Programming and Scripting

How to grep nth word in line?

my input file content is like this GEFITINIB 403 14 -4.786873 -4.786873 -1.990111 0.000000 0.000000 -1.146266 -39.955912 483 VANDETANIB 404 21 -4.754243 -4.754243 -2.554131 -0.090303 0.000000 -0.244210 -41.615502 193 VANDETANIB 405 21 -4.737541 -4.737541 -2.670195 -0.006006 0.000000 -0.285579... (4 Replies)
Discussion started by: chandu87
4 Replies

3. Shell Programming and Scripting

Grep the word from pattern line and update in subsequent lines till next pattern line reached

Hi, I have got the below requirement. please suggest. I have a file like, Processing Item is: /data/ing/cfg2/abc.txt /data/ing/cfg3/bgc.txt Processing Item is: /data/cmd/for2/ght.txt /data/kernal/config.klgt.txt I want to process the above file to get the output file like, ... (5 Replies)
Discussion started by: rbalaj16
5 Replies

4. Shell Programming and Scripting

Grep to isolate a text file line and Awk to select a word?

I am looking at using grep to locate the line in the text file and them use awk to select a word or words out of it. I know awk needs -v to allow a variable to be used, but also needs -F to allow the break up of the sentence and allow the location of separate variables. $line = grep "1:" File |... (8 Replies)
Discussion started by: Ironguru
8 Replies

5. Shell Programming and Scripting

Command to grep a word and print the whole line splitted into many

Hi, I need to search a word in the java file. Assume the line in the java file is, (the line was splitted into 3 lines) 1.operationContext.sendFeedback(2.FeedbackType.ERROR, null, "Input is empty.", "Input Details: pr 3.ovide Valid pair(s): "+pairType); When i grep for the word... (6 Replies)
Discussion started by: tulasiram
6 Replies

6. UNIX for Dummies Questions & Answers

Can grep command return word instead of complete line

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

7. Shell Programming and Scripting

grep a word instead of a line

Hi all, I'm a noobie at shell scripting (and Linux) with no experience on programing. I'm trying to create a script that will download my xml calendar from Google, process it in the format and dump it into $HOME/.calendar/calendar. Eg: April 10 Event I'm having a hard time using... (4 Replies)
Discussion started by: victorbrca
4 Replies

8. Shell Programming and Scripting

grep a word from a specific line

for example: searches only for single word for single word this is line three match=$(grep -n -e "single" data.txt) this command will stored "..... single ...... single" into search. how can i grep the single word just from line 2 only?? (3 Replies)
Discussion started by: blurboy
3 Replies

9. UNIX for Dummies Questions & Answers

grep a word from a line

Hi there, Is there a way to grep a word from a line and display only the words beginning from the search word? Say I have a file named file.txt that contains below: I am a file Hello there Reader Orbix I hope you feel good today What I want is to grep the word "there": $ grep "there"... (2 Replies)
Discussion started by: Orbix
2 Replies

10. Shell Programming and Scripting

print a line containing word in a column using grep

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
Login or Register to Ask a Question