Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Remove()
- {
- echo "Remove"
- echo "Please enter the surename of the record you want to remove(case sensitive):"
- read remove
- grep -n "$remove" book.txt
- status=`echo $?`
- if [ $status -eq 1 ]
- then
- echo "No records found for \"$remove\""
- else
- echo "Enter the line number of the record you want to remove."
- read remL
- for line in grep -n "$remove" book.txt
- do
- number=`echo "$line" | cut -c1`
- if [ $number -eq $remL ]
- then
- lineRemove="${remL}d"
- sed -i -e "$lineRemove" book.txt
- echo "The record was successfully removed!"
- fi
- done
- fi
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement