The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 06-25-2009
Vijay81 Vijay81 is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 1
UNIX script for reading a file and creating another file

Hi,

I am a beginner in scripting...I have to do a script where I have to read a file which has list of job names, line by line and for every line execute a dsjob command to find the log details of the job and extract only the start time of the job, if it is greater than jan 01 2008 and create an output file which has the jobname that I read followed by a comma and the start time stamp value.

If I execute the dsjob (datastage) command for a job A12TRANJB, the expected results are:

dsjob -jobinfo DDW A12TRANJB

Job Status : NOT RUNNING (99)
Job Controller : not available
Job Start Time : Tue Feb 17 22:17:10 2009
Job Wave Number : 0
User Status : not available
Job Control : not available
Interim Status : NOT RUNNING (99)
Invocation ID : not available
Last Run Time : not available
Job Process ID : 0
Invocation List : A12TRANJB

The highlighted job start time value in line 3 is the one i have to compare and if it is greater than 01/01/08, I have to write that to a file, with the job name, A12TRANJB.

I have a unix coding done for this, I know that there would be lot of mistakes..I have it here below:

HTML Code:
jobname= /apps/Ascential/Projects/jobnames
for line in $jobname
do
dsjob -jobinfo $jobname PRJ | grep `job start time` | cut -f2 -d > newfile
the highlihgted line is a datastage dsjob command which will get the job log details..

can some one please help me in this scripting?

thanks,
Vijay