Writing a shell script that receives 3 arguments but within the script one of the commands needs to check the first value after a delimiter is applied
#!/bin/bash
awk -F'\t' '$1 ~ /$1/&&/$2/ {print $1FS$3}' $3
this command is called:
bash search.sh 5 AM filename.txt
And should execute as follows:
awk -F'\t' '$1 ~ /5/&&/AM/ {print $1FS$3}' filename.txt
The command functions properly outside of the shell script, returns nothing right now when using it inside the shell script. filename.txt :
03:00:00 AM John-James Hayward Evalyn Howell Chyna Mercado
04:00:00 AM Chyna Mercado Cleveland Hanna Katey Bean
05:00:00 AM Katey Bean Billy Jones Evalyn Howell
06:00:00 AM Evalyn Howell Saima Mcdermott Cleveland Hanna
07:00:00 AM Cleveland Hanna Abigale Rich Billy Jones
Expected output:
05:00:00 AM Billy Jones