Computing.Net > Forums > Unix > grep scripts

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

grep scripts

Reply to Message Icon

Original Message
Name: gpatel
Date: August 29, 2005 at 07:48:52 Pacific
Subject: grep scripts
OS: unix
CPU/Ram: 512
Comment:

hello All,
I am trying to write a script that could do the following.

grep red *.out
grep blue *.out
grep complete *.out

now my problem is this is how file look like

time 123
hello 123
red 123
blue 123
time 234
hello 789
red 145 146
blue 123 147
complete 111

then the file start again w/ the same stuff above.

I only wanted to grep the last lines
red 145 146
blue 123 147

can someone help w/ this problem??
thanks in advance..
~gpatel


Report Offensive Message For Removal


Response Number 1
Name: David Perry
Date: August 29, 2005 at 13:05:15 Pacific
Reply:

Are you saying you only want the lines with 3 fields returned?


Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home



Results for: grep scripts

grepping script
    Summary: i would like to make a script that does the following: 1) echo the job number 2) based on the job number, i want it to grep files in a specified path with the word ( Job 1 ) we actually have many Job...
www.computing.net/answers/unix/grepping-script/5417.html

grep script
    Summary: Any idea how to begin writing a script that siplifies the use of grep.Because i have never before workout programming in unix but only in java is this going to be similar ? thanks in advance ...
www.computing.net/answers/unix/grep-script/5861.html

script program
    Summary: Don is correct: file *|grep script|less ...
www.computing.net/answers/unix/script-program/6409.html








Which MP3 player do you have?

iPod/iPhone
Zune
Something Else
None


View Results

Poll Finishes In 2 Days.
Discuss in The Lounge
Poll History






Data Recovery Software