Basic Regular Expressions: Working with Hardware Data

30 minutes
  • 2 Learning Objectives

About this Hands-on Lab

Regular expressions allow us to take the most complicated pieces of text and match the patterns within them for a variety of results, but to learn regular expressions we have to start somewhere. Using a combination of literals, digits, and word characters, alongside some basic text processing commands (such as `grep`), we can match product IDs and architectures and parse down a large product list into something more manageable.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Parse and save CPU data.

Use a regular expression to parse through the intel-cpus.cvs file. Save the results as intel-options.csv.

Parse and save GPU data.

Use a regular expression to parse through the gpus.cvs file. Save the results as gpu-options.csv.

Additional Resources

You work for Ethercloud, a web hosting company. Ethercloud keeps their own servers, and the time has come for an upgrade in hardware. Two CSV files have been provided to you: One features a list of current Intel CPUs and another of GPUs.

It has been requested that you parse down the list so that only the desired options are included for the CPU list, then for the GPU list. You know that the architecture required all follows the same basic pattern, as provided by the examples below. Using whatever tools you desire (such as grep), generate a new file comprised only on CPUs matching the appropriate product IP, then create another list of GPUs.

Intel CPUs

The CPU list can be found in the cloud_user home directory, as intel-cpus.csv. Save the parsed down file as intel-options.csv.

Your regex should match the following sample product IDs:

E3-1225V6
E3-1230V6
E3-1240V6
E3-1231V3
E3-1270V6
E3-1275V6

GPUs

A GPU list can be found in the cloud_user's home directory, as gpus.csv. Save the parsed down file as gpu-options.cvs.

Your regex should match the following sample architectures:

GF100-030-A3
GF100-100-KD
GF100-275-A3
GK104-225-A2
GK110-425-B1
GK208-301-A1

Note that there is more than one correct method to complete this learning activity and more than one correct regular expression.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!
Thanks for reaching out!

You’ll hear from us shortly. In the meantime, why not check out what our customers have to say about ACG?