Sponsored Content
Top Forums Shell Programming and Scripting need help with understanding and modifying script Post 302159599 by dakkorn on Friday 18th of January 2008 04:04:06 AM
Old 01-18-2008
need help with understanding and modifying script

hi all,

i am new to UNIX. this is my first time using Ubuntu. i need to do this for my fyp.

i am using an artificial neural network model to predict the yield strength of steel. the shell script used to execute this model is as shown here:

#Thomas Sourmail, Cambridge University / Neuromat Ltd

echo "*******************************************************"
echo "* Model to estimate the elongation (%) of a steel *"
echo "* as a function of elemental composition, heat and *"
echo "* mechanical treatments and grain size. *"
echo "* *"
echo "* More information: Materials Algorithms Project *"
echo "* *"
echo "* Model prepared with the Model Manager, Neuromat Ltd *"
echo "* More information: Neuromat Ltd::Modelling Solutions for Materials Science *"
echo "* *"
echo "* Authors: T.C.Illingworth, T.Sourmail, H. Bhadeshia *"
echo "* and D.J.C. MacKay *"
echo "*******************************************************"
echo "Press Return to continue"
read dummy

echo "*******************************************************"
echo "* *"
echo "* DISCLAIMER: This program, is provided AS IS without *"
echo "* warranty of any kind. We make no warranties, express*"
echo "* or implied, that this program, procedures and data *"
echo "* are free of error, or are consistent with any parti-*"
echo "* cular standard of merchantability, or that they *"
echo "* will meet your requirements for any particular *"
echo "* application. *"
echo "* IT SHOULD NOT BE RELIED ON FOR SOLVING A PROBLEM *"
echo "* WHOSE INCORRECT SOLUTION COULD RESULT IN INJURY TO *"
echo "* A PERSON OR LOSS OF PROPERTY. *"
echo "* *"
echo "* If you do use this program, it is at your own risk. *"
echo "* The Department of Materials Science and Metallurgy, *"
echo "* University of Cambridge, and the National Physical *"
echo "* Laboratory disclaim all liability for direct, inci- *"
echo "* dental or consequential damages resulting from your *"
echo "* use of this program. *"
echo "* *"
echo "*******************************************************"
echo ""
echo "Agree ? (y/*)"
read answer

correct='y'

if test $answer != $correct
then
exit
fi
#To normalise the data
wc test.dat > wc.out
read line total dummy < wc.out
rm wc.out

no_of_lines=$line
let no_of_columns=$total/$line

cmd='echo $line > no_of_rows.dat'
eval $cmd

echo ""
echo "I found $no_of_lines lines and $no_of_columns variables" > predict.log
echo ""

./.normalise $no_of_lines $no_of_columns >&-

# Count again in case the first line contained labels

wc norm_test.in > wc.out
read line total dummy < wc.out
rm wc.out
no_of_lines=$line
echo "Now $no_of_lines line in norm_test.in" >> predict.log

# This is to produce the required instruction file for generate44

./.generate_spec $no_of_columns $no_of_lines $no_of_lines 1 $no_of_lines spec.t1 norm_test.in d/outran.x >&-

# The list of models making up the committee, you can edit that if you wish
# to remove the contribution of some models (just place a # in front of the two
# corresponding lines)

./.generate44 spec.t1 13 ./c/_wm6f ./c/_wm6f.lu >&-
mv _out outprdt/out1
./.generate44 spec.t1 17 ./c/_wq6f ./c/_wq6f.lu >&-
mv _out outprdt/out2
./.generate44 spec.t1 14 ./c/_wn6f ./c/_wn6f.lu >&-
mv _out outprdt/out3
./.generate44 spec.t1 14 ./c/_wn3f ./c/_wn3f.lu >&-
mv _out outprdt/out4

# Combining the individual models into committee result

./.gencom 4 $no_of_lines ./outprdt >&-

#To un-normalise the result

./.treatout $no_of_lines $no_of_columns

mv com.dat outprdt/com.dat
#mv test.dat outprdt/test.dat
#mv unnorm_com result

rm _* no_of_rows.dat norm_test.in spec.t1

echo "Display results ? (y/*)"
read answer
if test $answer = $correct
then
cat result
fi
echo "*******************************"
echo "* *"
echo "* Predictions done *"
echo "* results saved in 'result' *"
echo "* *"
echo "*******************************"



when i run the program this is what shows:

desktop:~/Desktop/YS$ ./model.gen
*******************************************************
* Model to estimate the elongation (%) of a steel *
* as a function of elemental composition, heat and *
* mechanical treatments and grain size. *
* *
* More information: Materials Algorithms Project *
* *
* Model prepared with the Model Manager, Neuromat Ltd *
* More information: Neuromat Ltd::Modelling Solutions for Materials Science *
* *
* Authors: T.C.Illingworth, T.Sourmail, H. Bhadeshia *
* and D.J.C. MacKay *
*******************************************************
Press Return to continue

*******************************************************
* *
* DISCLAIMER: This program, is provided AS IS without *
* warranty of any kind. We make no warranties, express*
* or implied, that this program, procedures and data *
* are free of error, or are consistent with any parti-*
* cular standard of merchantability, or that they *
* will meet your requirements for any particular *
* application. *
* IT SHOULD NOT BE RELIED ON FOR SOLVING A PROBLEM *
* WHOSE INCORRECT SOLUTION COULD RESULT IN INJURY TO *
* A PERSON OR LOSS OF PROPERTY. *
* *
* If you do use this program, it is at your own risk. *
* The Department of Materials Science and Metallurgy, *
* University of Cambridge, and the National Physical *
* Laboratory disclaim all liability for direct, inci- *
* dental or consequential damages resulting from your *
* use of this program. *
* *
*******************************************************

Agree ? (y/*)
y




CREATING 'spec.t1' ........
-----------------------------------------------
Generating outputs using network
-----------------------------------------------
-----------------------------------------------
Generating outputs using network
-----------------------------------------------
-----------------------------------------------
Generating outputs using network
-----------------------------------------------
-----------------------------------------------
Generating outputs using network
-----------------------------------------------


You have not precised the name of the minmax and data files Using MINMAX and com.dat by default
4 39 MINMAX
160.6175991124.322998
Display results ? (y/*)
y
Prediction Error Pred-Err Pred+Err
372.627014 122.571762 250.055252 495.198761
387.139435 115.390228 271.749207 502.529663
399.405487 109.249504 290.155975 508.654999 409.364410 104.132217 305.232208 513.495667
*******************************
* *
* Predictions done *
* results saved in 'result' *
* *
*******************************
benedict@benedict-desktop:~/Desktop/YS$




i need to get rid of the disclaimer and i dont want the computer to ask to press return to continue or agree or ask display results. i just want it to run the program and give the results automatically. how shd i modify the attached file to achieve this? when i run the program it shd just show the following.


CREATING 'spec.t1' ........
-----------------------------------------------
Generating outputs using network
-----------------------------------------------
-----------------------------------------------
Generating outputs using network
-----------------------------------------------
-----------------------------------------------
Generating outputs using network
-----------------------------------------------
-----------------------------------------------
Generating outputs using network
-----------------------------------------------


You have not precised the name of the minmax and data files Using MINMAX and com.dat by default
4 39 MINMAX
160.6175991124.322998
Prediction Error Pred-Err Pred+Err
372.627014 122.571762 250.055252 495.198761
387.139435 115.390228 271.749207 502.529663
399.405487 109.249504 290.155975 508.654999 409.364410 104.132217 305.232208 513.495667
*******************************
* *
* Predictions done *
* results saved in 'result' *
* *
*******************************


Can anyone help me modify the program to do this?

Your help will be greatly appreciated.

Thank you.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help modifying script to loop through all folders

I have this script someone very kindly help me write last year which loops through all files in a folder and does a command. I need to modify it to loop through all sub-folders of a main folder and only perform the command on files modified after Jan 1st 2008. And I need the command to place the... (3 Replies)
Discussion started by: Fred Goldman
3 Replies

2. Shell Programming and Scripting

Modifying a .ksh script

Hi users, I am on a beginner level and just joined this site. I have created a simple .ksh file in the following manner cat <<EOF >mfile #!/bin/ksh echo "hello world" EOF Request for some help with 2 cases 1. now i would like to add a second line after the first echo command... (4 Replies)
Discussion started by: corbusier
4 Replies

3. Shell Programming and Scripting

Modifying the ntpd deamon script

I need to replace the line daemon ntpd $OPTIONS in the following script with daemon ntpd $OPTIONS 2>&1 > /var/log/ntpd.log & what will happen? The idea of replacing is to capture the output on the console into ntpd.log file. Will this work? ... (1 Reply)
Discussion started by: naive1977
1 Replies

4. Shell Programming and Scripting

modifying perl script

Hi freinds I have a small problem I want u to help me in, I have a syslog server and configured it to send me email automatically, I get a small perl script to help me in, and tested it to send alerts to root and it worked successfully without any problems Now I want to send it outside, I... (4 Replies)
Discussion started by: reaky
4 Replies

5. Shell Programming and Scripting

modifying file using script

Hi, I am new to shell programming, and want to know is it possible to change the contents of file using script? for example, if want to search 2 words and want to replace these words with 2 new words. Regards, Manoj (4 Replies)
Discussion started by: manoj.solaris
4 Replies

6. UNIX for Dummies Questions & Answers

Modifying a shell script without using an editor

Hi all, I really wan't to know that how to edit a shell script with out using an editor.. Is there any command? (4 Replies)
Discussion started by: buddhi
4 Replies

7. Shell Programming and Scripting

Modifying the Restart Script

Hello, I have a shell script which calls for an existing script with appropriate parameters. It looks something like this. -------------------------------------------------------------------------- #!/bin/bash sh /root/ams_rc stop_shepherd > /dev/null sleep 30 sh /root/ams_rc... (9 Replies)
Discussion started by: Siddheshk
9 Replies

8. UNIX for Dummies Questions & Answers

Understanding / Modifying AWK command

Hey all, So I have an AWK command here awk '{if(FNR==NR) {arr++;next} if($0 in arr) { arr--; if (arr == 0) delete arr;next}{print $0 >"list2output.csv"}} END {for(i in arr){print i >"list1output.csv"}}' list1 list2 (refer to image for a more readable format) This code was submitted... (1 Reply)
Discussion started by: Aussiemick
1 Replies

9. Shell Programming and Scripting

awk script for modifying the file

I have the records in the format one row 0009714494919I MY010727408948010 NNNNNN N PUSAAR727408948010 R007YM08705 9602002 S 111+0360832-0937348 I want to get it int the format 0009714494919I MY010727408948010 NNNNNN N PUSAAR727408948010 R007YM08705 9602002 S ... (2 Replies)
Discussion started by: sonam273
2 Replies

10. Shell Programming and Scripting

Need some help modifying script

I have a script that currently runs fine and I need to add or || (or) condition to the if statement and I'm not sure the exact syntax as it relates to the use of brackets. my current script starts like this: errLog="/usr/local/website-logs/error.log" apacheRestart="service httpd restart"... (3 Replies)
Discussion started by: jjj0923
3 Replies
All times are GMT -4. The time now is 01:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy