Question: # ! / bin / bash #Author: Name #Purpose: This script processes a data file to produce 5 output files based on specified criteria #Check

#!/bin/bash
#Author: Name
#Purpose: This script processes a data file to produce 5 output files based on specified criteria
#Check if a file name is provided
if [[ $# -eq 0]]
echo "Usage: $0"
exit 1
fi
inputFile="$1"
#Task 1: Add a header and output the data to move1.txt
echo "Name Phone Number Jan Feb Mar" > move1.txt
cat "$1">> move1.txt
#Task 2: Duplicate the file, replace "John" with "Mary, and save to move2.txt
sed 's/John/Mary/g' $1> move2.txt
#Task 3: Extract donors with area code 888 and save their names to move3.txt#grep -Eio "^[[:alpha:]]+[[:alpha]]+" $1| grep -E "^\w+\w+%[[:digit:]]3888-"> move3.txt
#Task 4: Extract first names of donors whose last name starts with M or N
#grep -Eio "[MN][[:alpha:]]+[[:alpha:]]+" $1| sed 's/[[:alpha:]]+//'> move4.txt
#Task 5: Find people who donated at least $10.00 in any month, save their name and number, sorted by last name
#grep -F '%''{
#if($3>="$10.00"|| $4>="$10.00"|| $5>= $10.00|| $6>=$10.00{print $1"%"$2}' $1| sort -t''-k2>> move5.txt
Can you please fix this code with regex and grep?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!