Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prompt and act. 1

Status
Not open for further replies.

tijerina

Vendor
Mar 4, 2003
132
US
Thanks PHV and VGERSH99, you both get kudos. Thanks so much. And I do apologize for the double post, but I still have a question.

I want to write a script that will allow me to do the following, but I am not sure where to start:

I execute the script ---

I want the script to prompt for the input file to use so the sed or nawk command will strip the file for me.

And then prompt for the name of the output file, and when that is entered then the scipt will end and say please cat your $output file to view the results.

Can anyone help?

Thanks..
 
In your shell man page, pay attention at the read special command.
For example, in ksh :
read input?"Name of input file "

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Thanks, but again, I am not sure where to begin. I guess I am mentally making this harder than it is.
 
To get started do a keyword search in this form for read ksh menu

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Thanks for the tip on the forum, yes it did help, but I am getting this stupid error.

Here is the simple script I have:


#!/bin/ksh -x

echo "What is the full path of the file you want to pars?"

read ANSWER

echo "What is the full path name of your output file?"

read ANSWER2

sed 's![0-9]\{8\}$!!'$ANSWER > $ANSWER2

<here is where it says that no such file, talking about $ANSWER2 --- any idea what I did wrong?>>

echo "I am currently parsing ${ANSWER}"

echo ""

echo "Done"

echo ""

echo "This is what your output file looks like after the parsing"

cat $ANSWER2
 
Lack of space ?
[tt]sed 's![0-9]\{8\}$!!'[highlight] [/highlight]$ANSWER > $ANSWER2[/tt]

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
PHV ---You just darn right rock!

Thanks for the help and the great lead.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top