I have a list of files in a directory that I want to check position 2-6 for a string of EPIP or EPCN. I ran the following command but it isn't working correctly:
ls EPDa*.*.*.data |cut -c1-30
All it is doing is cutting the file name not what is in the file. Any help would be appreciated.
That is because you are telling it to list the files instead of displaying the contents of the files. Use cat instead of ls and possibly pipe to more after the cut command. If these are really data files (check with file EPDa*.*.*.data ) then you probably do not want to try to display to your terminal since it will probably hang it up. You might want to check out the strings command.
If I did a cat it would only do one file. Iwant it to go through the list of files. I need to know in which file there is the string EPIP. Something like : EPDaemon.1234.data EPIP. Is this possible?