[ale] Fun bash thing

Jim Kinney jkinney at jimkinney.us
Sat Nov 9 14:54:56 EST 2024


Nope. Diff is order dependent and my use cases are not ordered. I'm only looking for presence or absence. But if a line is different then that gets flagged as "not present". For sanity I'll go both directions.

I could do a sort then diff but for how I use this info, the simple list of "missing" works well.

On November 9, 2024 10:57:32 AM EST, Pete Hardie via Ale <ale at ale.org> wrote:
>Does diff not have enough options to get you the "in A but not in B" info?
>
>On Sat, Nov 9, 2024 at 10:35 AM Jim Kinney via Ale <ale at ale.org> wrote:
>
>> I've done similar but usually output to a different file using the
>> some-command as an extractor/processor often for line-by-line mangling. Did
>> not know it dumps the entire input file into memory first. Hmm. That has
>> possibilities as well as potential gotchas related to size. Usually the
>> memory is not a problem but if the system is already in heavy use it could
>> be impactful.
>>
>> Nice. Very nice.
>>
>> My latest fun toy is a grep to find what is in fileA that's not in fileB
>> with one item per line for each.
>>
>> grep -Fvxf fileB fileA
>>
>> Really useful for finding kernel sysctl setting changes between large
>> systems. Thousand line files are ms times.
>>
>> On Sat, Nov 9, 2024, 10:09 AM Charles Shapiro via Ale <ale at ale.org> wrote:
>>
>>> Learned this off mastodon today.
>>>
>>> **
>>>
>>> Here's an interesting Bash pattern I just used for the first time.
>>>
>>> some-command <<<"$(< some/file)" >some/file
>>>
>>> It reads all of some/file into memory before writing it to some-command's
>>> stdin. This lets some-command's stdout be redirected to some/file without
>>> the usual problems of reading/writing from the same file.
>>>
>>> **
>>>
>>>
>>> H/T to @trs at metasocial.com <trs at metasocial.com>
>>>
>>>
>>> -- CHS
>>> _______________________________________________
>>> Ale mailing list
>>> Ale at ale.org
>>> https://mail.ale.org/mailman/listinfo/ale
>>> See JOBS, ANNOUNCE and SCHOOLS lists at
>>> http://mail.ale.org/mailman/listinfo
>>>
>> _______________________________________________
>> Ale mailing list
>> Ale at ale.org
>> https://mail.ale.org/mailman/listinfo/ale
>> See JOBS, ANNOUNCE and SCHOOLS lists at
>> http://mail.ale.org/mailman/listinfo
>>
>
>
>-- 
>Pete Hardie
>--------
>Better Living Through Bitmaps
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.ale.org/pipermail/ale/attachments/20241109/b694318e/attachment.htm>


More information about the Ale mailing list