Using sed to filter a file, outputting matching patterns only

I’m parsing a dictionary file from Princeton University’s WordNet, but the only part I’m interested in extracting from the file is the word itself. grep won’t work for this since you can only output a matching line, but not a single matching word or pattern from a file.

The file structure looks like:

{ Bigfoot, Sasquatch, legendary_creature,@i (large hairy humanoid creature said to live in wilderness areas of the United States and Canada) }
{ Demogorgon, deity,@i noun.group:Greek_mythology,;c ((Greek mythology) a mysterious and terrifying deity of the underworld) }
{ doppelganger, legendary_creature,@ (a ghostly double of a living person that haunts its living counterpart) }
{ Loch_Ness_monster, Nessie, legendary_creature,@i noun.object:Loch_Ness,#p (a large aquatic animal supposed to resemble a serpent or plesiosaur of Loch Ness in Scotland) }
{ sea_serpent, legendary_creature,@ (huge creature of the sea resembling a snake or dragon) }

The second word in the file is what I’m looking for, so the output should be:

Bigfoot
Demogorgon
Loch_Ness_monster
sea_serpent

Let’s start with a simpler example first. Given a string “apple potato tomato”, let’s filter to print only words starting with “po”

$ echo "apple potato tomato" | sed -E -n "s/.*(po[[:alpha:]]+).*/\1/p"
potato

Breaking it down:

-E : used extended regex
-n : surpress outputting each line of the input
.*(po[[:alpha:]]+).*
- match any characters, then as a capture group () starting with po then 1 or more other alpha characters, followed by any other characters
\1 - replace match with capture group 1
/p - print only matches

Now that’s use the same approach to match just the first word on each of the dictionary file lines:

sed -E -n "s/{[[:space:]]([[:alpha:]]+\_*[[:alpha:]]*).*/\1/p" ./dict/dbfiles/noun.person >> noun.person.parsed.txt

ArcaOS install on VirtualBox

My first job out of college was with IBM as a contractor, working in the IBM Software Center, Basingstoke, providing technical support for OS/2 and Communications Manager/2. I ran OS/2 on my own PC at home for a few years after this, before moving to Windows 95.

In the past few years I’ve installed various versions of OS/2 in virtual machines for nostalgic reasons. I’ve also kept an eye on Arca Noae’s ArcaOS as a current day commercial offering of OS/2 complete with updated drivers and hardware support for current day hardware. For a personal install though I’ve been reluctant to pay the $120 for a personal license, but recently decided to bite the bullet and buy a copy.

I like collecting screenshots of OSes during the install process, and this post is one of those 🙂

After the typical ‘white square’ top right and ‘OS/2’ text, we get to the first installer screen:

After accepting the license agreements, the next page is interesting, it prompts you to select a ‘personality’, a pre-configured set of features depending on how you intend to use this installation. I’ll select the default/first option for now. I don’t remember seeing options like this during a typical OS/2 install, maybe Warp 4 provided options like this (I’ll go check later):

I have a blank 2GB virtual disk on VirtualBox for this install, so I’ll select the option to format it. Later when I do a bare metal install I’ll be doing the same on a blank partition on a new SATA SSD:

Prompted to reboot:

The familiar shutdown compete dialog!

After rebooting, you’re back at the first page of the install again. Stepping through the same options we’re now prompted to select the install volume:

There’s no volumes in the dropdown yet, so press the Manage Volumes button:

I clicked on the Volume menu option, then ‘Create new’, then the ‘Standard/bootable’ option:

I kept the default C and named the volume:

I’m using all the free space on this volume, so kept the defaults:

Volume manager now looks like this:

Closing this dialog I’m prompted to save and now the volume is selected:

Next up, location settings. Huh, remember code pages? I set my timezone, DST, and internet time sync:

This next one is interesting and allows you to configure your hardware options. This is obviously where ArcaOS shines in it’s ability to support hardware of the time as well as updated support for current hardware:

Also interesting that support for VirtualBox is selected by default as the installer recognizes we’re installing on VirtualBox:

I kept all options as default for now. When I do a bare metal install next I’ll check out what the Display options are.

Network driver install next and prompted for machine name, workgroup, and username:

Ready to install – let’s go!

Off we go. Noticeably absent and the messages telling you about the various features that you get during a Warp install:

Time to reboot:

During the install there’s a couple reboots we are automatic if you leave the checkbox selected.

Done! Up and runnning!

There is no fast track to gaining experience in Software Development

It’s a common mistake in our industry that people when first starting out believe they can spend [insert any short number of days here, like 30, 60, 100] days learning a programming language and then they’ll be an expert, easily get a job and hit the ground running. The reality is that software development is not something that you can learn over night, it take time, and it takes practice (with regular feedback).

You can learn the basics of programming and a specific language in a few weeks, but to take those basics and use that knowledge to build anything larger than a simple app or contribute within a development team, you’ll rapidly discover how much you actually don’t know.

A career in software development is a continual learning process. As you work with a specific toolset in a specific functional area, you’ll continually come across new things that you haven’t seen before, you’ll see what works and what doesn’t work. You’ll gain experience as you go and become more comfortable applying your skills and experience to solve problems you’ve seen before, and also become more comfortable solving new problems as what you’ve seen before often helps understand a new problem and find an appropriate solution quicker.

When you start a new project or a new job, you’ll often find this whole process repeats, especially if you’re starting with a new framework or toolset that you haven’t used before. And this repeats throughout your career.

It takes time to gain experience, and unfortunately there is no quick or easy shortcut other than hands-on experience, practice, and continual learning.