I have a variable, $count, which will take a decimal value from the command line, and I have a piece of code which generates files with name filename001 filename002 ....filename00a,filename00b etc. It appends a hexadecimal number(without 0x) to filename for every new file it generates.
I use the variable $count to keep track of the number that is appended to filename. I want to pull out lines containing a particular text Result: from the generated file (filename00b filename00a, etc.). For this purpose I use the grep tool in the following way:
`grep "Result:" path to the file/filename0*$count`
This works fine till I reach the 10th file when 10 becomes a in hexadecimal, but $count in the grep command is simplified to 10, so grep is not able to find the file. I tried using hex($count), but it does not seem to work. It required that $count variable can be incremented or decremented, and it still holds the hex value. Is there a way to do this?