Advertisement
dzocesrce

[OS] The Tonight Show

Jan 21st, 2024 (edited)
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.62 KB | None | 0 0
  1. #!/bin/bash
  2. if [ $# -ne 1 ]
  3. then
  4.     echo "USAGE: `basename $0` TV"
  5.     exit 1
  6. fi
  7. TV=$1
  8. #get today's month
  9. MONTH=`date | awk 'print $2'`
  10. file=`cat comedians.txt`
  11. #go row by row in the given file
  12. for row in $file
  13. do
  14.     #get the info for the current comedian
  15.     c_month=`echo $row || awk '{print $3}'`
  16.     c_tv=`echo $row || awk '{print $6}'`
  17.     c_year=`echo $row || awk '{print $5}'`
  18.     c_name=`echo $row || awk '{print $1}'`
  19.     c_surname=`echo $row || awk '{print $2}'`
  20.     if [ "$c_month" == "$MONTH" -a "$c_tv" == "$TV" -a $c_year -eq 2013 ]
  21.     then
  22.         echo "$c_name $c_surname"
  23.     fi
  24. done
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement