Goal
Use regular expressions in commands and scripts. Read help on Windows command findstr and Linux utility grep. Use grep with option -P.
Output
Complete the following tasks and submit it to the correlating assignment submissions folder. Supply screenshots to support your answers.
Procedure
Complete the following tasks.
Tasks
- Write a regex that matches email in the following format: [email protected] (name may contain letters, digits, underscores, dashes and periods; domain contains the same minus underscores; tld is a top-level domain).
- Example: [email protected] is a valid email
- Example: [email protected] is invalid (tld is invalid, too long)
- Write a regex that matches email in the following formatS: [email protected], name @ uiu.edu, name at uiu dot edu (in each case name may contain no more than 1 period).
- Write a Windows script, pipe or command that prints a line from the file sciencemath.html that contains my last name (Yasinovskyy).
- Write a Windows script or a pipe that finds all lines of a sciencemath.html that contain an email and saves them to a file harvest.txt (saved lines may contain other text, not just email).
- Write a Windows script or a pipe that counts number of Science and Math faculty emails (hint: use findstr and find).
- Write a Windows script that asks what file ([A]rts, [B]usiness, [E]ducation, [S]cience) a user wants to process and prints number of email addresses in that file.
- Write a Linux script or a pipe that prints names of Science and Math faculty.
- Write a Linux script or a pipe that prints emails of all UIU faculty and saves them (emails only) to a file harvest.txt.
- Write a Linux script that takes any faculty name as an argument and prints school affiliation of that person person's email (process all 4 files).
- Write a Linux script that takes any faculty name as an argument and prints that person person's email (process all 4 files).