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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

user entered filename in a different directory 1

Status
Not open for further replies.

stevenawk

Programmer
Nov 12, 2008
9
DE
HI,

AWK program:

echo -n "Enter from date: "
read fromDate
echo -n "Enter to date: "
read toDate
echo -n "Enter log name: "
read log
nawk -v fd="$fromDate" -v td="$toDate" '$0>="[" fd && $0<="[" td "9"' $log

This allows a user to enter a log name, which is then used as the input by the program. But the log is in a different folder called "results".

I have tried "/results/"$log, in the above but it doesnt work. Please can you explain why?
My folder structure is: /steve/awkfolder/results.
My programs live in awkfolder. The log files are in results.

Thanks,

S.
 
This isn't an awk problem but simply shell syntax:
nawk -v fd="$fromDate" -v td="$toDate" '$0>="[" fd && $0<="[" td "9"' /steve/awkfolder/results/$log

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Yes !

i did tinker with file paths - and it does need the whole path from the top, down.

many thanks,

S.
 
> need the whole path...

not always - depends on what the user's process current dir is


HTH,

p5wizard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top