i have a command and pipe into different conditions as follows,
cat $txt | grep -v "\/\*" | awk -F$'\t' '{if ($16=="N") print $0}' | awk -F$'\t' '{if ($48=="Y" || $48==".") print $7}'
this command works perfect in the terminal
However, when I include the command in a bash.sh, it does't work at all. I created a test.sh The script just looks like this :
#!/bin/bash
txt=file.txt
cat $txt | grep -v "\/\*" | awk -F$'\t' '{if ($16=="N") print $0}' | awk -F$'\t' '{if ($48=="Y" || $48==".") print $7}' >> output.txt
Then, I simplely use
sh test.sh
It generated a output.txt, but this is no any information in output.txt
Anyone has any idea what is different ?