searching in a while where a word is not there.

Hi,

I am new to unix, pls help

I have a file suc_Logfile file. liek this.

output
success
success
abc

Now i need to generate a file in shell script where it shows only abc.
Now i am doing like this
grep "^successfully\|$" $suc_Logfile >> $Final_Suc
Pls help.

Thanks,
Sailaja

What's the point of trying to grep "successfully" when it isn't even present in your file ?

Do you want to grep the word "successfully" ?
Or the word "abc" ?

tyler_durden

Thanks for your reply.

I want to grep for the word abc.

---------- Post updated at 06:12 PM ---------- Previous update was at 06:12 PM ----------

sorry that success was a typo error. its actually successfulll.

Then guess what word you'll want to use with grep.

tyler_durden

Hi Durden , I got confused. let me write it clearly here.

I have a outfile generated like this.
DB20000I The SQL command completed successfully.
DB20000I The SQL command completed successfully.
abc
DB20000I The SQL command completed successfully.
DB20000I The SQL command completed successfully.
def
DB20000I The SQL command completed successfully.
DB20000I The SQL command completed successfully.
ghi
DB20000I The SQL command completed successfully.
DB20000I The SQL command completed successfully.
jkl

Now i need the output as
abc
def
ghi
jkl

sorry for the confusion.

THanks,

Hi Sailaja,

Below command can be used to remove lines with "successfully" from your output.

grep -v "successfully" file

Regards,

Ranjith

sed "/successfully/d" file.txt