LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   C Shell - Traversing a file (https://www.linuxquestions.org/questions/linux-newbie-8/c-shell-traversing-a-file-647515/)

lundq1kp 06-06-2008 05:45 PM

C Shell - Traversing a file
 
I am currently trying to write a C Shell script that informs the user when a processing job has finished. I have a file that can be continually updated about the processing jobs.


When the job is in progress the file looks like this

Job id Name User Time Use S Queue
------------------- ---------------- --------------- -------- - -----
3962.master MM-PBEPBE juanp 1150:19: R verylong
3964.master MM-PBE1PBE juanp 1069:31: R verylong
3987.master MMC-SVWN5 juanp 660:32:0 R verylong
4031.master MM-9-PBEPBE juanp 304:06:5 R verylong
4032.master MM-9-PBE1PBE juanp 303:58:4 R verylong
4033.master MM-9-HSE1PBE juanp 54:08:48 R verylong
4034.master MM-9-B3LYP juanp 20:30:58 R verylong
4076.master MM-HF juanp 03:21:22 R verylong
4077.master MM-HSE1PBE juanp 0 Q verylong
4110.master ...ex1-1.7-ULSDA thuk 120:19:1 R verylong
4145.master ...1.87-UHSE1PBE thuk 23:21:48 R verylong
4149.master Cusp-H karl 0 Q short

And when the job has finished, it looks like this

Job id Name User Time Use S Queue
------------------- ---------------- --------------- -------- - -----
3962.master MM-PBEPBE juanp 1150:19: R verylong
3964.master MM-PBE1PBE juanp 1069:31: R verylong
3987.master MMC-SVWN5 juanp 660:32:0 R verylong
4031.master MM-9-PBEPBE juanp 304:06:5 R verylong
4032.master MM-9-PBE1PBE juanp 303:58:4 R verylong
4033.master MM-9-HSE1PBE juanp 54:08:48 R verylong
4034.master MM-9-B3LYP juanp 20:30:58 R verylong
4076.master MM-HF juanp 03:21:22 R verylong
4077.master MM-HSE1PBE juanp 0 Q verylong
4110.master ...ex1-1.7-ULSDA thuk 120:19:1 R verylong
4145.master ...1.87-UHSE1PBE thuk 23:21:48 R verylong

With the bottom entry missing.

How would I write a C Shell scipt to inform me, or be able to proceed with other instructions when the the file no longer contains the bottom entry.

syg00 06-06-2008 06:41 PM

Start by looking up the man pages for "tail" and "grep". Maybe also "sleep".


All times are GMT -5. The time now is 07:23 PM.