Boston Linux & UNIX was originally founded in 1994 as part of The Boston Computer Society. We meet on the third Wednesday of each month, online, via Jitsi Meet.

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss] Please help with a BASH puzzle



David,

Thank you for your suggestion, but they are not only number, but alpha 
values too.

Sorry, though: I chose poor examples.? The file can contain any digit 
0-9, and any alpha A-Z. There are no punctuation marks and no white space.

Sorted values range from 0000 to ZZZZ.

HTH.

Bill


On 8/23/2019 6:51 PM, David Kramer wrote:
> 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
> _______________________________________________
> Discuss mailing list
> Discuss at blu.org
> http://lists.blu.org/mailman/listinfo/discuss



Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org