I need to list all files where 1rst column=ABK and char position 123 to 125=ZBK:
For the first part I can I can do a awk '{$1="ABK";print}' file and for the second a cut -c123-125 file | grep ZBK but this would only work partially..
That worked perfectly as I expected thanks a lot for both answers!
I have just one more question: Since I have hundred of files instead of doing your awk command file, I would like to run it to all files (awk command *) and therefore I would also need to list/print all files containing the result of my awk command.
There is a bug in my code: the index function will return the string position only for the first match, so if there is a match before the specific position the record will not be printed even if it contains the required data.
Thanks for your reaction radoulov. As a matter of fact I saw this morning in one of our production servers that yesterday's command only worked in some files.
I'm using substr insted of index in your awk command and for now it seems it's working properly, I'll come back to you if I have other problem.