Issue
I have a text file with two columns.
Product Cost
Abc....def 10
Abc.def 20
ajsk,,lll 04
I want to search for product starts from "Abc" and ends with "def" then for those entries I want to add Cost. I have used :
grep "^Abc|def$" myfile
but it is not working
Solution
Use awk. cat myfile | awk '{print $1}' | grep query
Answered By - Heman Gandhi Answer Checked By - Pedro (WPSolving Volunteer)