URGENT grep question


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting URGENT grep question
# 1  
Old 11-07-2008
CPU & Memory URGENT grep question

I want to grep "abc" from "logyy". I want not only the instance of "abc" to return, but the line just above it as well (no matter what it is).
Smilie
Can some one please assit me to drive on this
# 2  
Old 11-07-2008
try : grep -E -B 2 expr file
# 3  
Old 11-07-2008
or if you don't have that grep version:

Code:
 awk '/abc/ { print prev; print } { prev = $0 }' logyy

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Very urgent question please!!!!

I have a file like below. I need from each group of messages only first lines after error. Could you pleasde help me to write a correct program? expected output is like this "Error 126614 in debt instrument header for debt instrument ID 10115537: The rating reason RATING AFFIRMED selected for... (1 Reply)
Discussion started by: digioleg54
1 Replies

2. Shell Programming and Scripting

Urgent help req with grep + sed

HI all, i have a line in a file it cantains one;two_1_10;two_2_10;two_3_10;three~ now i need to get the output as one;two_1_abc_10;two_2_abc_10;two_3_abc_10;three~ ( 1 should be replaced with 1_abc for two__10 , and one more thing the number of occurances of two_value_10 will be... (1 Reply)
Discussion started by: 2001.arun
1 Replies

3. HP-UX

Make_Recovery Question Urgent Plse Respond

I have a make_recovery tape, if I restore the VG00 volume group using this, will my other volume groups still be ok after the restore(I have 7 data volume groups) I used make_recovery -A to create the tape I have a HP9000 HP-UX 11 An internal disk is failing, the other volume groups are on... (3 Replies)
Discussion started by: rees_a
3 Replies

4. Shell Programming and Scripting

Urgent Awk Question

I need to get the lines in a log file matching a particular string, and print out the output to the screen from the point of the match, to the end of the file. I know this code does it: awk '/regex/,0' but the string I need to search for inside the log file looks something like this: ... (4 Replies)
Discussion started by: SkySmart
4 Replies

5. Solaris

MB/P0/F0 urgent question

I have sunfire question and getting the following error message through prtdiag. MB/P0/F0 RS failed 0 rpm What it means? Please help me ASAP. (2 Replies)
Discussion started by: mokkan
2 Replies

6. Shell Programming and Scripting

Urgent help on grep the nearest value

Hi, I have a list of data in text files with :- ColA ColB ColC ColD ColE ColF 12 122 2280 30 0.012987 1.776 13 118 2280 30 0.012987 1.954 14 115 2620 30 0.011321 2.131 15 113 2654 30 0.011177 2.309 16 145 1882 25 0.013110 2.487 17 112... (2 Replies)
Discussion started by: ahjiefreak
2 Replies

7. Shell Programming and Scripting

Trouble with grep again :(.. URGENT plss!

Frenz, I have a file with certain columns from ls -lR which looks something like: file stemp ---------- lrwxrwxrwx ./temp/s1 -> 2.ksh lrwxrwxrwx ./temp/s2 -> 3.ksh lrwxrwxrwx ./temp/subtemp/s3 -> 1.ksh lrwxrwxrwx ./temp/subtemp/s4 -> 2.ksh lrwxrwxrwx ./temp/s5 -> ... (9 Replies)
Discussion started by: manthasirisha
9 Replies

8. Shell Programming and Scripting

One Last Question about Core Files (distinguish) URGENT

now, what do you define as core files. there are some files outthere with the name perl.core, I-core.png, core.png I mean, are these classified as core files too??? i thought core files are simply files called "core". Please help me out this is urgent (2 Replies)
Discussion started by: TRUEST
2 Replies

9. Shell Programming and Scripting

File Existence Question (Urgent)

G'day all Just wondering if anyone can help me, is it possible, within a Bourne Shell script, to check if a entered file exists? :confused: An example would be (And this is the reason why I'm asking) If I was to write a super-basic backup script, and the user entered a filename, what sort of... (2 Replies)
Discussion started by: Aussie_Bloke
2 Replies
Login or Register to Ask a Question