I am very new to bash scripting and I need to write a bash script that takes two arguments, a string and a file. The output should be each line which matches the string from the beginning of the line. For example, given a string "ANA" the line starting with "ANABEL" will be printed, but the line starting with "SUSANA" will not. I need to use grep.
what I have tried is as follows:
#!/bin/bash
grep $1 $2
But this doesn't work, any help or direction will be very help, thanks in advance.