i don't really understand that coding Salem..but i try this and its works..
on top of script i declare a var like this
set readGrep = `grep -i $input carfile`
if ( "$readGrep" == "") then
echo "invalid data"
else
grep -i $input carfile | ......(as the script...
i think i have the solution already..using grep and pipe with awk
grep -i '$input' carfile | awk '{print $2}' ..u were rite salem i did have a mismatched {}
but the problem is (as im still new in linux) how to create an error msg if the user enters an input that didn't match any of the section...
hi guys, sorry if i posted so many questions in a single topics...CaKiwi i've try your code but the result is unmatched..
the basic idea of creating the system is to display the car chasis no,model and age by entering either car model,year or age...
i try to use grep and filter it with awk but...
tq 4 the source CaKiwi eventhough i havent try it yet ;)this comes to another question...how should i make this program ignore lower or upper cases? I've read about the IGNORECASE but how to use it?
switch ("$choice")
case "[Aa]":
echo -n "Please Enter The Car Model : "
set input="$<"
gawk '/$input/ {print "Car Model: "$2;print "Chassis No:
"$1;age=(2003-$4);print "Age of the car: "age}' carfile
echo...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.