Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to calculate the md5sum of one string per line in my ls dump:



However the md5sum should be calculated without the 'first dot'. I've written a simple script so far:

while read line
echo $line | exec 'md5sum'

./ < directory_listing.txt

How can I remove the first dot from each line?

share|improve this question
Why not just generate the file without it in the first place? – Ignacio Vazquez-Abrams Jul 6 '11 at 9:08
that file was not generated by me, so i cant. – JosiP Jul 6 '11 at 9:09
exec isn't doing anything useful here -- just use echo "${line#./}" | md5sum. – Gordon Davisson Jul 6 '11 at 14:36
$ foo=./abc/123
$ echo "${foo#./}"
share|improve this answer


echo $line | exec 'md5sum'


echo $line | cut -c 2- | exec 'md5sum'
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.