I need to get the md5 sum of a file on AIX, but the md5sum program prints the sum followed by the name of the file.

How can I get the sum without the file name.

link|improve this question

67% accept rate
How are you getting the md5 computation? – Chris Nov 5 '10 at 14:01
nix or windows? – aking1012 Nov 5 '10 at 14:07
@Chris md5sum, as noted. – C. Ross Nov 5 '10 at 14:28
@aking1012 nix, I don't know how I forgot that. – C. Ross Nov 5 '10 at 14:29
then gencha's answer should be sufficient...you can use any number of tools to split fields - awk, cut, whatever – aking1012 Nov 5 '10 at 14:54
show 1 more comment
feedback

2 Answers

up vote 1 down vote accepted
md5sum < filename

This will give you an empty filename.

link|improve this answer
1  
That outputs a - to represent stdin. – Dennis Williamson Nov 5 '10 at 15:53
This is what i use. Don't need cat though, just redirect md5sum < filename – Rich Homolka Nov 5 '10 at 16:53
Good point @Rich, I do like that better – heavyd Nov 5 '10 at 18:58
feedback
md5sum filename | awk '{print $1}'

That would be one way.

link|improve this answer
That is what I was thinking, just was not sure how he was getting the md5 in the first place. – Chris Nov 5 '10 at 14:03
@Chris I figured this was the way as he mentioned the md5sum program. – Oliver Salzburg Nov 5 '10 at 14:05
feedback

Your Answer

 
or
required, but never shown

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