I am writing a script, I want to check if the first line of the file matches a certain pattern and if it does then print out the file. How can I achieve this?
How do I check for pattern? Is there a way to check for pattern and based on the output do something..
EDIT: Please take a look at this question: https://stackoverflow.com/questions/5536018/how-to-get-match-regex-pattern-using-awk-from-file
I want something like this, but none of them worked for me. I basically want to check if the first line matches a regex pattern or not and based on that print the lines of file.