Script to take .xls file and read it for each server


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script to take .xls file and read it for each server
# 1  
Old 05-21-2013
Script to take .xls file and read it for each server

Script to take .xls file and read it for each server "/aix/test/$server_pre.xls" and then removes all the disks as provided in the file and then give output as below for each server, but am getting error where it says cannot find directory.
server_name: server1
Disk Cleaned
hdisk1 hdisk1 deleted
hdisk2 hdisk2 deleted
..... ......
..... ......
Code:
#!/usr/bin/ksh
# set -x
ofile=/cleanup_logs/disk-cleanup.$$
for server in `cat host_list.txt`
do
cat /aix/test/$server_pre.xls | grep hdisk | while read i
do
clean=`rmdev -dRl $i`
if [ $? != 0 ]
then
echo "Command Failed for $i"
fi
echo " $server "   >> $ofile
echo "   $i    |    $clean   " >> $ofile
done

# 2  
Old 05-23-2013
xls files are not the text grep is most reliable handling, so are these realy csv files or do you need xls2txt ?

The first part is repeated the same for every server.
# 3  
Old 05-23-2013
server_pre is a valid variable name, but probably not what you want... Use brackets like ${server} to force the name to end where you want.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Converting xls file to xlsx on UNIX script / command line.

Hi All, Am needing advise on how to convert xls file to xlsx format on Solaris unix command line or scripting. I tried searching online but it looks like I need to either use Perl packages of Excel or Python packages or some other 3rd party tool. Problem is to install any of these will require... (2 Replies)
Discussion started by: arvindshukla81
2 Replies

2. Shell Programming and Scripting

Perl script to convert xlsx to xls file

Hi I am trying one perl script to convert xlsx to xls file but could not able to get all the rows and columns in the xls file . This scriptFILE is basically to convert XLSX to CSV .. I am tweaking the script to convert XLSX to XLS file also #######################FILE... (3 Replies)
Discussion started by: kshitij
3 Replies

3. UNIX for Advanced & Expert Users

Shell script for dealing with XLS file with multiple tabs/worksheets

Hey Guys , Recently working on a requirement , i had to deal with XLS file with multiple tabs and the requirement was as below : 1. Convert one XLS file with multiple tabs to multiple CSV files. -- As i was working on MAC , so it was quite easy through APPLESCRIPT to deal with this.But... (2 Replies)
Discussion started by: himanshu sood
2 Replies

4. Shell Programming and Scripting

Shell script to read from a file and update remote server

Its a tough one and would appreciate any guidance for a script that i am trying to develop....Again I do understand its a complicated script and help would be greatly appreciated.... Thank you 1- Need to check for a file (in a certain location on a server) every 15 minute or so if it is there... (4 Replies)
Discussion started by: aavam
4 Replies

5. Shell Programming and Scripting

How to read from txt file and write it to xls?

Hello All, I just want help in coding a simple shell script since i am a newbie for UNIX and i started learning unix and shell scripting basics recently. I am having a data like this in .txt file. Product Name : XYZ Price : 678.1 Best Buy Price : 600 Product Name : ABC Price : 465... (3 Replies)
Discussion started by: vasanth_123
3 Replies

6. Shell Programming and Scripting

How to create xls file using unix script

Hi All, I want to create an xls file using shell script. I mean that I have written one script. It is having sql output. So I want to save that sql output into one xls file and I want to send that file as a attachment to my team MAIL_IDs. Can You any guy help me in this? Thanks in... (3 Replies)
Discussion started by: raghu.iv85
3 Replies

7. Shell Programming and Scripting

Sending/append result from CSH script to xls file

Hi, 1st post... Done a quick search for this so apologies if I've missed it. Basically I want to output and and append several values generated by a csh script direct to an xls openoffice file, rather than send to txt file and then physically copy and paste to xls file. Already I send... (4 Replies)
Discussion started by: scottyjock
4 Replies

8. Shell Programming and Scripting

converting xls file to txt file and xls to csv

I need to convert an excel file into a text file and an excel file into a CSV file.. any code to do that is appreciated thanks (6 Replies)
Discussion started by: bandar007
6 Replies

9. UNIX for Dummies Questions & Answers

Unix script to convert .csv file to.xls format

I have a .csv file in Unix box i need a UNIX script to convert the.csv files to.xls format. Its very urgent please help me. (1 Reply)
Discussion started by: moon_friend
1 Replies

10. Shell Programming and Scripting

How to extract output from a script to .xls file

Hi, I am running a script, the output of which is needed to be filled in .xls file. I am doing this manually now, i mean I am writing the output of the script to Excel file manually. How to redirect the output of the script to .xls file? Please help me out!!! Thanks much, Scriptlearner. (6 Replies)
Discussion started by: scriptlearner
6 Replies
Login or Register to Ask a Question