Session Ready
Exercise

Using SList to grep

You get woken up in the middle of the night by a frantic phone call from a co-worker. There is a rogue process running in production that is generating hundreds of extra backup files. It was discovered when your co-worker tried to restore from backup, but found hundreds of backup files that are corrupt. You need to write a script to isolate the correct backup file.

Use the SList object to find all files with the number 2 in them and print out their full path so the backups can be inspected. The reason 2 is so important is this corresponds to the second day of the week Tuesday. This is the last time the backups worked properly.

Instructions
100 XP
  • Use the SList result object to find all files with the pattern '_2' in them.
  • Use the grep method to accomplish this task.
  • Iterate over the results of the SList query and create a full path to the file.
  • Print the full path to files matching this query.