[Discuss] Please help with a BASH puzzle

David Kramer david at thekramers.net
Fri Aug 23 18:51:43 EDT 2019


Are these hex numbers?  bc can convert hex to decimal and do hex math.  
The hard part is calculating the next value, and here's an example of 
doing that.

nextValue=`echo "obase=16; ibase=16; ${lastValue} + 1" | bc`

Then all you need to do is compare whether the next line you read is 
equal to nextValue.


On 8/23/19 6:32 PM, Bill Horne wrote:
> Thanks for reading this: I appreciate your time.
>
> I'm trying to do something that should be very easy to do, and yet I 
> can't remember how to do it, and I'm asking for help.
>
> I have an alpha-numeric, sorted file, that looks like this:
>
> 01AA
>
> 01AB
>
> 01AC
>
> 01AE
>
> 01AF
>
> .. etc.
>
> I'm trying to remember what BASH utility, script, or  command would 
> flag the missing value (in this case, "01AD"). There are, of course, 
> any number of ways to program a solution, but I can't remember which 
> of the BASH utilities will do it. All suggestion welcome, and thanks 
> in advance.
>
> Bill Horne
>
> _______________________________________________
> Discuss mailing list
> Discuss at blu.org
> http://lists.blu.org/mailman/listinfo/discuss


More information about the Discuss mailing list