Currently, I need to make a script using cat
, awk
, and grep
.
I need to specify variables where a 4-digit date
can be used as an argument and a time
that can be looked up as an argument as well.
My script is as follows:
date=$1 time=$2 cat $date_Dealer_schedule.txt | awk -F' ' '{print}' | grep -i $time
The command to run this script:
sh roulette_dealer_finder_by_time.sh 0310 '02:00:00 PM'
What this should output is:
02:00:00 PM Chyna Mercado Billy Jones Cleveland Hanna
What I’m getting:
grep: pm: No such file or directory
If I were to do this without a script and a normal command like:
cat 0310_Dealer_schedule.txt | awk -F' ' '{print}' | grep -i '02:00:00 PM'
Then it works, but I need it to be a script and it is failing.
I’m using GitBash on Windows 11.
- I’ve tried as a normal command and the outcome I want works.
- I tried putting that similar structure into a script, but it gives me an error
TTG is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.