ls local* | tail -1
gives a file name for example localhost.txt. I want grep to search for pattern inside this file and not in the filename string. The following doesnt work since it looks for pattern in the filename string rather than inside the file. gives a file name for ex