Q:

Counting duplicate lines based on user input without showing certain information

Hi i got this short code that i want to use to count the number of duplicate lines but i only wish for the number to be shown
the input of the file
 The Hunger Games:Suzanne Collins:1:1:1
 The Hunger Games:test:1:1:1

desired output 
 found: 2    

the output with the code below
 found: 2 The Hunger Games

Code that was used
 echo "Title: "
 read title
 record=$(grep -io "$title" BookDB.txt | sort | uniq -c)
 echo "found: " $record

A:

You can use awk or cut
Awk
 echo "found: " $record | awk '{print $1  $2}'

Cut
 echo "found: 2 The Hunger Games" | cut -f1-2 -d" "

Test
$ echo "found: " $record | awk '{print $1  $2}'
found: 2
$ echo "found: 2 The Hunger Games" | cut -f1-2 -d" "
found: 2

