help needed to write script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting help needed to write script
# 1  
Old 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
# 2  
Old 04-26-2006
Please don't post a follow up as a new thread. Either edit your original post, or if the update is significant (i.e. you're not just trying to bump your thread), post a follow-up in the same thread.

I have removed your duplicate thread.

Thanks
ZB
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Urgent help needed to write a script

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

2. Shell Programming and Scripting

How to write this script?

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

3. Shell Programming and Scripting

Need to write a script...

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

4. Shell Programming and Scripting

Please help me to write the script

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

5. Shell Programming and Scripting

Expect script help needed- script failing if router unavailable

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

6. Shell Programming and Scripting

write a script

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

7. IP Networking

read/write,write/write lock with smbclient fails

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

8. Shell Programming and Scripting

help needed .. Unable to write the data to new file after matching the pattern

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

9. UNIX for Dummies Questions & Answers

Should I write a PERL Script or Shell Script?

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

10. Shell Programming and Scripting

Help needed to write a shell script!

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
Login or Register to Ask a Question