04-25-2006
help needed to write script
I have to do a directory clean up on several machines. The task is as follows:
1. create a directory ' SCRIPTCLEANUP ' ( i KNOW IT)
2. list the directory
3. if directory and start with 'DQA' leave it,
4. if directory or file move it to the newly crated directory ( blanck directory delete)
5. It also requires to produce a report like this
The directory contains xx unnecessary files and yy directory. The details are as follows:
Directory
Files
i can do the first step
I think I can do the second, we can loop as '
for i in *
do
if [ -f $i || -d (^DQA $i) ]
mv $i ./scriptcleanup
fi
ech $ > report ( but i do not know how to insert in particular place like under Files or
Directory section in the output file. )
done
I am working in ksh environment.
Thanks in advance
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I need to login to multiple servers(around 20) every day and get error messages from log file.The command i use to get this done is "$more /var/log/messages |grep error" and copy error messages.
I want this to be automated using a shell script and mail error messages to a given email id.
... (3 Replies)
Discussion started by: sreedharsn
3 Replies
2. UNIX for Dummies Questions & Answers
Hello,
I have done some BASIC shell scripting/PERL scripting before so I am familiar with the languages. I am not really sure which one would lend itself better to the application I have to write.
I am required to scan the message logs for possible break in attempts. If I use shell scripting... (2 Replies)
Discussion started by: mojoman
2 Replies
3. Shell Programming and Scripting
Hi,
i am pretty new to Unix environment .....
Can i get some help from any of you guyz on writing Unix script.
my requirement is like reading a csv file, finding a specific pattern in the lines and repalce the string with new string and write it to another file.
My file is file ABC123.dat... (3 Replies)
Discussion started by: prashant_jsw
3 Replies
4. IP Networking
Hi,
We have smb client running on two of the linux boxes and smb server on another linux system. During a backup operation which uses smb, read of a file was allowed while write to the same file was going on.Also simultaneous writes to the same file were allowed.Following are the settings in the... (1 Reply)
Discussion started by: swatidas11
1 Replies
5. Shell Programming and Scripting
Dear Madam/Sir
Who can help me with writing a script doing the following?
1- Read names of files (only files with special name format let say initially they have the same file name start like TT*)
2- Then create an empty files with the same names have been read in step one but with extension... (4 Replies)
Discussion started by: m.nageeb
4 Replies
6. Shell Programming and Scripting
Hey all. Sometimes I'm tasked to change some router configs for the entire network (over 3,000 Cisco routers). Most of the time its a global config parameter so its done with a loop and an IP list as its the same configuration change for all routers. This is working OK.
However, sometimes an... (3 Replies)
Discussion started by: mrkz1974
3 Replies
7. Shell Programming and Scripting
Hi All,
I have written the follwing script to take the backup of the file every day
along with the date.
DATE=`date +%Y%m%d`
export DATE
cp var/hr/hr333m.txt cp var/hr/payments/hr333m_$DATE.txt
The file name as follows after taking the backup.
hr333m_20110630.txt
Could you... (3 Replies)
Discussion started by: ajaykumarkona
3 Replies
8. Shell Programming and Scripting
Hello all,
I am new to shell scripting. I want to write a shell script which will give me the output of the following query as an attachment in a mail
SELECT /*+ parallel(a,4)*/ban, subscriber_no, business_id, price_plan_code, call_action_code, special_seq_no, toll_soc, toll_feature_code,... (1 Reply)
Discussion started by: paraspawar
1 Replies
9. Shell Programming and Scripting
How to write this script?
I want to write script so that is "/var" partition exceeds 90% then it should mail to me.
Please give me guidelines.
Thanks!!!!!!!!!!!!!!!!!!!!!!!!!!:confused: (3 Replies)
Discussion started by: manalisharmabe
3 Replies
10. Shell Programming and Scripting
User have given me about 450 commands, i just wanted to know the full path for those commands and the output should be redirected to a separate file.
Instead of running "which" command each time to find the path for all those commands, i need to do this in a simple way by a script.
which... (3 Replies)
Discussion started by: pgmax
3 Replies