| | |
Please it is very Important for me ....Please help me ...
Please support our Shell Scripting advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jun 2009
Posts: 2
Reputation:
Solved Threads: 0
I have written a shell script below while running this script , we have to give inputs manually, now i want that we are getting inputs in excel file ..can we automate this , this was a project for me , i am alreday late ..please help me soon
Shell Scripting Syntax (Toggle Plain Text)
#!/bin/bash echo -e "CREATION OF NEW MRTG LINK " echo -e "Enter Configuration File Name " read cfg_filename echo -e "Enter Customer Name To Be Displayed " read cust_name echo -e "Enter Short Name " read short_name echo -e "Enter SNMP String " read string echo -e "Enter Router/Switch name " read router_name echo -e "Enter Router/Switch IP " read router_ip echo -e "Enter Port Details Along with " read port_dtls echo -e "Enter WAN IP Address " read wan_ip echo -e "Enter BW Allocated " read bw lower=`echo $short_name | tr 'A-Z' 'a-z'` bw_config=`echo $bw/8*1000 | bc` echo "Directory[$lower]:$lower">>/cfg/$cfg_filename echo "Target[$lower]: -$port_dtls:$string@$router_ip:">>/cfg/$cfg_filename echo "MaxBytes[$lower]:$bw_config">>/cfg/$cfg_filename echo "Title[$lower]:Traffic Analysis for $cust_name.">>/cfg/$cfg_filename echo "PageTop[$lower]: <H1>Traffic Analysis for $cust_name.</H1>">>/cfg/$cfg_filename echo " <TABLE>">>/cfg/$cfg_filename echo " <TR><TD>Max Speed:</TD><TD>$bw Kbps</TD></TR>">>/cfg/$cfg_filename echo " <TR><TD>Port@Router/Switch:</TD><TD>$port_dtls:@$router_name</TD></TR>">>/cfg/$cfg_filename echo " <TR><TD>Wan Ip:</TD><TD>$wan_ip</TD></TR>">>/cfg/$cfg_filename echo " </TABLE>">>/cfg/$cfg_filename tail -10 /cfg/$cfg_filename filename=`echo $cfg_filename |cut -d . -f 1` echo $filename echo $lower #echo "For Creating Index File For MRTG User" echo "Creating Directory" mkdir /home/www/mrtg/$filename/$lower echo "Directory Created for $lower" echo "Creating index for $lower" sleep 5 cat /root/scripts/index.html | sed s/eswarthemad.html/$lower.html/g > /root/scripts/tmp.html cp /root/scripts/tmp.html /home/www/mrtg/$filename/$lower/index.html cho "Created index for $lower"
Last edited by Ancient Dragon; Jun 28th, 2009 at 7:33 am. Reason: add code tags and disable smilies
What is your question here? You are wanting to remove the user inputs and have it query an excel file instead?
Upload it in mysql database and use perl/php to read the data.
If you use a .CSV then you can use an array in bash and split it that way. Here is a start
You can change the "cat userfile" to "grep ^something" to find your row and then use
bash Syntax (Toggle Plain Text)
declare -a varray for aline in `cat $USERFILE` do varray=(`echo $aline | awk '{ split($0, ulist, ","); for(i=1; i<=11; i++) printf ulist[i] " "; }'`) aname=${varray[0]} amode=${varray[1]}
You can change the "cat userfile" to "grep ^something" to find your row and then use
${varray[N]} to get at specific elements ![]() |
Similar Threads
- How important is it to learn and understand... (Computer Science)
- URGENT HELP NEEDED - critically important...!!! (Windows NT / 2000 / XP)
- Help - Most Important Windows Maintenance Tasks (IT Professionals' Lounge)
- important file ccl30.dll missing????? (Viruses, Spyware and other Nasties)
- What is most important? (Monitors, Displays and Video Cards)
- How Important is rundll32.exe? (Windows NT / 2000 / XP)
Other Threads in the Shell Scripting Forum
- Previous Thread: getopts
- Next Thread: Syntax to use a variable in a for loop
| Thread Tools | Search this Thread |






