BLU Discuss list archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Discuss] Please help with a BASH puzzle
- Subject: [Discuss] Please help with a BASH puzzle
- From: worley at alum.mit.edu (Dale R. Worley)
- Date: Fri, 30 Aug 2019 21:50:49 -0400
- In-reply-to: <mailman.10349.1566609140.14410.discuss@blu.org> (discuss-request@blu.org)
discuss-request at blu.org writes: > From: Bill Horne <bill at horne.net> > 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: > I'm trying to remember what BASH utility, script, or? command would flag > the missing value (in this case, "01AD"). Of course, the hard part is doing it without materializing the list of all possible words with which you want to compare your file. # Input a series of lines containing one word each and output each word # extended in all possible ways by one character out of an ordered alphabet. # In this example, the alphabet is 0, 1, 2, and 3. function extend () { while read WORD do echo ${WORD}0 echo ${WORD}1 echo ${WORD}2 echo ${WORD}3 done } # Compare the complete list of 3-letter words with the file "sample". comm -13 sample <( echo | extend | extend | extend ) Dale
- Follow-Ups:
- [Discuss] Please help with a BASH puzzle
- From: david at thekramers.net (David Kramer)
- [Discuss] Please help with a BASH puzzle
- Prev by Date: [Discuss] Reliable external HD enclosure for Linux?
- Next by Date: [Discuss] Reliable external HD enclosure for Linux?
- Previous by thread: [Discuss] Please help with a BASH puzzle
- Next by thread: [Discuss] Please help with a BASH puzzle
- Index(es):