I need a better way to read the first character of each line in a file and check if it equals the special character �. This character tells me where there is a break in the reports. The file has over 500,000 lines. Currently, this is my code -
if [[ $(echo $line|cut -c1-1) = "�" ]]
I am using Korn Shell as a scripting language. Is there a better way to do this?
It would work if you use the enhanced korn shell (ksh93). For something that takes this long it might be worth testing to see which is faster, assigning it to a one character variable with typeset in the standard korn shell or using the enhanced korn shell's variable substitution. Of course going from 5 hours to 45 minutes is already a pretty nice improvement.