I am trying to figure out a way to write a shell script that lists file names that start and end with certain characters/digit but also contain a certain string in the file.
So say the file name has to start with a digit and end with a character, but that file also has to contain "xyz". How would I work it out so that the result is just the name of the files.
The file names should be looked for in the current directory.
I know how to get them separately but I dont know how to combine the two together to get the proper outcome.
Example: List file names:
-starting with "F" and ending with a digit.
-contains "xyz" within the file.
File1 = "xyz"
File2 = "xYz"
File3 = "xyz"
tile4 = "xyz"
File = "xyz"
Here only File1 and File3 would be listed because they meet the criteria
filenames = content
is very confusing, but the description seems clear enough. Thanks for the edit. – Quasímodo Oct 8 '20 at 22:24