Issue
I need to calculate md5sum of one string (pathfile) per line in my ls
dump, directory_listing_file
:
./r/g4/f1.JPG
./r/g4/f2.JPG
./r/g4/f3.JPG
./r/g4/f4.JPG
But that md5sum should be calculated without the initial dot. I've written a simple script:
while read line
do
echo $line | exec 'md5sum'
done
./g.sh < directory_listnitg.txt
How do I remove the first dot from each line?
Solution
Set the field separator to the path separator and read everything except the stuff before the first slash into $name
:
while IFS=/ read junk name
do
echo $name
done < directory_listing.txt
Answered By - l0b0