I have a file with strings with pre-defined format:
src/history_of_vim.txt - 1803 - Wed Jul 14 11:59:15 +07 2021 - ef669ffc3a7fc1c502c7be34d478757c1efe1aa6fd5768174e33542cb26c62bd - sha256
src/history_of_vim.txt - 1853 - Wed Jul 14 12:03:51 +07 2021 - ef669ffc3a7fc1c502c7be34d478757c1efe1aa6fd5768174e33542cb26c62bd - sha256
I need to write a bash script that counts number of lines, number of unique files (e.g. I have only 1 unique - history_of_vim.txt) and number of unique checksums.
I've done the following code (input path is only an example):
count_lines=0
while IFS= read -r line
do
count_lines=${countlines+1}
done < "$input"
echo $count_lines
But it only helps with the first task.
I was trying to use awk with delimiter '-' and then print the exact positions that I need and take only unique with sort -u. However, I can't bring it out together to make it work.