ksh programming ..Any new ideas??


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ksh programming ..Any new ideas??
# 1  
Old 08-25-2010
ksh programming ..Any new ideas??

Hi masters

I am in search for a script i am unable to write,I am not getting a proper logic .Could u pls help me ?

I have a program that will create the directory named thatday date (eg :08.24.10) .This progam runs daily and creates directories according to date.

Now i want to write a script so that it runs every monday and should look into last 7 days directory files and grep the line Job Name : EDWAD101 :: WOD : Status: Success :: Started : 00:45:47 Completed :: 00:45:47 from all the files in that directory

This output should be appended in a txt file so that that file will have the full status of jobs which was run in the last week

Waiting for your early reply

Thax in advance

silu

# 2  
Old 08-26-2010
Fist suggestion is, date format in file name or folder name as 20100824 will be more easier for scripting and comparing than format as 08.24.10

Then yo need GNU date to simplify your script as below:

Code:
d=$(date -d "yesterday" +%Y%m%d)

find *$d* -type f -name "*$d*" -exec grep "Success.*Completed" {} \; >> $d.report.log

This User Gave Thanks to rdcwayx For This Post:
# 3  
Old 08-26-2010
Thx for the reply!

Hi

What does d=$(date -d "yesterday" +%Y%m%d) do ?

Our program creates a directory name as you said .Excellent guess appreciate that

Thanks for all the help

Silu
# 4  
Old 08-26-2010
Code:
date -d "yesterday" +%Y%m%d    # will get the day of yesterday

then assign it to $d

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help me get some ideas

Hello, I have been given a scripting project, but have not learned any scripting. I need to get some ideas on how to start. Attached is part of the project: I have no idea how to parse the arguments. What I had in mind was to get the arguments ($1, $2, ... ) and have if statements for different... (1 Reply)
Discussion started by: facepalm
1 Replies

2. UNIX and Linux Applications

Need ideas for graduation project based on unix or linux Need ideas for graduation project based on

Dear all, i am in last year of electronics department in engineering faculty i need suggestions for a graduation project based on unix or free bsd or linux and electronics "embedded linux " i think about embedded unix for example or device drivers please i need helps (1 Reply)
Discussion started by: MOHA-1
1 Replies

3. Programming

Shell programming ksh AIX - beginner

Hi! I have two shell scripts - Script1, Script2 Script1, Script2 - have return parameter Script1 - is calling Script2 in Script2 I am calling program sqlldr - if this program is called then I did not get the return parameter from Script1 Do You have any idea how can I avoid this problem. Mroki (6 Replies)
Discussion started by: mroki
6 Replies

4. Shell Programming and Scripting

KSH Programming to read and mail fields

I have a file with the following values: File name à a.log (bulk file with 100+ lines with the similar format) aaaa|bbbb|cccc|dddd|eeee|ffff|gggg|hhhh|iiii| aaaa|bbbb|cccc|dddd|eeee|ffff|gggg|hhhh|iiii| aaaa|bbbb|cccc|dddd|eeee|ffff|gggg|hhhh|iiii|... (3 Replies)
Discussion started by: shivacbz
3 Replies

5. UNIX for Dummies Questions & Answers

Carreer:Networking Programming in Unix (C programming Language)

Hello, I am trying to learn Networking Programming in C in unix enviorment. I want to know how good it is to become a network programmer. i am crazy about Network programming but i also want to opt for the best carreer options. Anybody experienced Network Programmer, please tell me is my... (5 Replies)
Discussion started by: vibhory2j
5 Replies

6. Shell Programming and Scripting

any ideas?

i need to compare to dates/times given in the format MMDDhhmmYY. That is month, day, hour, minute, year. It is a 24 hour clock. I need to compare two dates to check that they are, say, less than 900 seconds apart. I have got to a point where it checks the time, turns the values into seconds and... (5 Replies)
Discussion started by: fwabbly
5 Replies

7. Shell Programming and Scripting

Programming in ksh and not in bash

Hi all.... I was wondering if there is a lot of differences between /bash and ksh programming. Im learning about bash programming, but all what I had read in this forum, points me to learn more about ksh over bash. Is that right and why? Unfortunately, I can’t write ksh progs on my work,... (2 Replies)
Discussion started by: TARFU
2 Replies

8. Shell Programming and Scripting

obtaining a line number in ksh programming

Hi People, how do i obtain the line number of a ksh shell script that i am working on For example in C,when u key in __LINE__ will return u the current line number of the src code. regards wilson (1 Reply)
Discussion started by: wilsontan
1 Replies

9. Shell Programming and Scripting

Looking for ksh programming documentation

Hello, I am looking for documentation about shell programmation in ksh. I have to understand what are doing some scripts and I am rather a dummy in UNIX. What web site or book would you advice me ? Thanks. (2 Replies)
Discussion started by: Filippo
2 Replies
Login or Register to Ask a Question