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 > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
help me in sending parameters from sqlplus script to unix shell script Hara Shell Programming and Scripting 2 01-29-2008 03:31 PM
Checklist for Shell Script reqd Shivdatta Shell Programming and Scripting 2 11-30-2007 10:59 AM
check in unix shell script so that no one is able to run the script manually adi_bang76 Shell Programming and Scripting 1 11-16-2006 10:43 AM
Difference between writing Unix Shell script and AIX Shell Scripts haroonec AIX 0 04-12-2006 02:27 AM
How to run unix commands in a new shell inside a shell script? hkapil Shell Programming and Scripting 2 01-04-2006 06:56 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-18-2008
venkatesht venkatesht is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 68
unix shell script reqd...

Task:

Short Description: To find the files in a particular directory for the previous day, sort them by date and time and e-mail it across to a particular id.

And the time is divided into eight fields and based on the time the respective field should be updated with the flag 1.

Eight fields look like (12 to 15, 15 to 18, 18 to 21, 21 to 24,
00 to 03, 03 to 06, 06 to 09 and 09 to 12)

And finally the total column should be updated with the no of files that belong to the same type.

Please find the attached excel sheet. Needs to send the attachment in this format to users.

Thanks in advance,
Venkatesh.
Attached Files
File Type: xls Core Dumps 05 Nov Example.xls (34.5 KB, 26 views)
  #2 (permalink)  
Old 11-18-2008
DukeNuke2's Avatar
DukeNuke2 DukeNuke2 is offline Forum Staff  
Soulman
  
 

Join Date: Jul 2006
Location: Germany, Berlin
Posts: 2,910
where is your problem? show us what you have done so far in your script.
  #3 (permalink)  
Old 11-19-2008
venkatesht venkatesht is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 68
I didn't get your question. I have prepared a script where it does finding the files in a directory for the previous day and e-mail it across to the respective users.

But i need to prepare a script where based upon time field the flag should be update with 1. Explained clearly this point. Please help.

Thanks,
Venkatesh.
  #4 (permalink)  
Old 11-19-2008
DukeNuke2's Avatar
DukeNuke2 DukeNuke2 is offline Forum Staff  
Soulman
  
 

Join Date: Jul 2006
Location: Germany, Berlin
Posts: 2,910
so show us what you have done so far. nobody is writing a script for you. we can help if you are stuck...
  #5 (permalink)  
Old 11-19-2008
venkatesht venkatesht is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 68
See the below script:

This is what i have done so far. Thanks in advance.

Code:
Y=`date +'%Y'`
M=`date +'%m'`
D=`date +'%d'`
#today=$Y$M$D
#echo $today

if [ $M -eq 01 -o $M -eq 03 -o $M -eq 05 -o $M -eq 07 -o $M -eq 08 -o $M -eq 10 -o $M -eq 12 ] && [ $D -eq 01 ];then
   yesterday=`expr $D + 30`$M$Y
else
if [ $M -eq 04 -o $M -eq 06 -o $M -eq 09 -o $M -eq 11 ] && [ $D -eq 01 ]; then
   yesterday=`expr $D + 29`$M$Y
else
if [ $M -eq 02 -a $D -eq 01 ]; then
   yesterday=`expr $D + 27`$M$Y
else
   yesterday=`expr $D - 1`$M$Y
fi
fi
fi

find /opt/pkms/sinteg/logs -name "Pk*" -mtime 2 -type f -exec ls -l {} \; > Txtfile

if [ -s Txtfile ];then
   cut -d ' ' -f 6- Txtfile > corefile
fi;

echo "Please find the following corefiles.\n" > EMAIL.txt

#Append the required fields to EMAIL.txt

cat corefile >> /opt/pkms/CGEYScripts/EMAIL.txt

#E-mail output to PKMS Team

mailx -s "corefiles_$yesterday" \Team@mail.com \ < /opt/pkms/CGEYScripts/EMAIL.txt

#if e-mail is successful, delete the files

errflag=$?

if [ $errflag = 0 ]
then
  rm /opt/pkms/CGEYScripts/EMAIL.txt
  rm Txtfile
fi

Thanks,
Venkatesh.

Last edited by vino; 11-19-2008 at 05:56 AM.. Reason: Removed email id from the post
  #6 (permalink)  
Old 11-20-2008
venkatesht venkatesht is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 68
Can anyone help me on this please?

Thanks,
Venkatesh.
  #7 (permalink)  
Old 11-20-2008
DukeNuke2's Avatar
DukeNuke2 DukeNuke2 is offline Forum Staff  
Soulman
  
 

Join Date: Jul 2006
Location: Germany, Berlin
Posts: 2,910
please don't "bump" up posts. it's against the rules. if anyone can help, they will... just wait a bit!
Sponsored Links
Closed Thread

Bookmarks

Tags
shell script, shell scripting, unix scripting, unix scripting basics

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 04:08 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0