How to get MD5 from a pipe stream and do not alter it?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to get MD5 from a pipe stream and do not alter it?
# 1  
Old 01-13-2013
How to get MD5 from a pipe stream and do not alter it?

Say I have a stream and want to get MD5 from it, without altering it. I won't know how big the stream is or how much time it will take to close. Here is the idea:

Code:
cat somefile | calculate md5 and put it somewhere | bzip2 > somefile.bz2

# 2  
Old 01-13-2013
Code:
cat somefile | openssl md5 | bzip2 > somefile.bz2

# 3  
Old 01-13-2013
Quote:
Originally Posted by bipinajith
Code:
cat somefile | openssl md5 | bzip2 > somefile.bz2

This is not what I need. That command outputs to stdout the checksum, instead of the original pipe stream.
# 4  
Old 01-13-2013
Code:
cat somefile | openssl md5 >&2 | bzip2 somefile

# 5  
Old 01-13-2013
Quote:
Originally Posted by bipinajith
Code:
cat somefile | openssl md5 >&2 | bzip2 somefile

Same thing

---------- Post updated at 06:01 PM ---------- Previous update was at 05:56 PM ----------

I've found it:

Code:
  cat somefile | tee >(openssl md5 > sum.md5) | bzip2 > somefile.bz2

# 6  
Old 01-13-2013
The cat serves no function in any of these examples.


Code:
< inputfile tee >(openssl md5 > sum.md5) | bzip2 > somefile.bz2

This User Gave Thanks to Corona688 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to reverse the b64 format(encoded b64(b64(md5($pass)))) into md5 hash format?

I have about 1500 rows (encoded b64(b64(md5($pass))) algorythm) in a file. I would like reverse the b64 into md5 hash format. How could I do that from command line? So I need only the correct md5 hash formats. These row format: 4G5qc2WQzGES6QkWAUgl5w P9tKxonBOg3ymr8vOBLnDA... (1 Reply)
Discussion started by: freeroute
1 Replies

2. Shell Programming and Scripting

Alter Fixed Width File

Thank u so much .Its working fine as expected. ---------- Post updated at 03:41 PM ---------- Previous update was at 01:46 PM ---------- I need one more help. I have another file(fixed length) that will get negative value (ex:-00000000003000) in postion (98 - 112) then i have to... (6 Replies)
Discussion started by: vinus
6 Replies

3. UNIX for Dummies Questions & Answers

Alter a part of a line specified by user

How can I adjust a specific field in a line that the user specifies... In other words, I have a file that contains several lines containing several fields separated by a comma. (name),(address),(ph. number) I want to ask the user which record he wants to adjust based on the name. ... (3 Replies)
Discussion started by: itech4814
3 Replies

4. Shell Programming and Scripting

Create md5 sums and archive the resulting md5 files

Hello everyone, I am looking to basically creating md5sum files for all iso files in a directory and archive the resulting md5 files into a single archive in that very same directory. I worked out a clumsy solution such as: #find files for which md5sum are to be created and store the... (1 Reply)
Discussion started by: SurfTranquille
1 Replies

5. UNIX for Dummies Questions & Answers

alter data in a file

Hi , I have data in file like below. status ----------- ------ 2287 C 1502 E 19 can anyone pls help me how can i get it modified as below status 2287|C|1502 E|19 can someone pls help. Thanks. (2 Replies)
Discussion started by: gaddamja
2 Replies

6. Shell Programming and Scripting

[Video stream] network stream recording with mplayer

Hi I used this command: mplayer http://host/axis-cgi/mjpg/video.cgi -user root -passwd root \ -cache 1024 -fps 25.0 -nosound -vc ffh264 \ -demuxer 3 -dumpstream -dumpfile output.avi It's ok but... Video Playing is very fast! Why? Is it a synch problem? What parameter I have to use for... (1 Reply)
Discussion started by: takeo.kikuta
1 Replies

7. UNIX for Dummies Questions & Answers

alter data in column

Hello All, I want to alter the first column of a dataset, say, 001 0.700 100.000 002 0.715 99.998 003 0.730 99.998 004 0.744 99.975 005 0.759 99.916 011 0.847 97.987 012 0.861 97.317 020 0.978 87.789 021 0.993 86.400 022 1.008 84.904 023 1.022 83.014 100 2.148 11.426 101... (2 Replies)
Discussion started by: tintin72
2 Replies

8. Shell Programming and Scripting

File Alter Problem--need help

i have 3 files a.txt , b.txt and c.txt each files have keyfields and some column fields e.g. a.txt keyfield1 keyfield2 keyfield3 col1 col2 col3 1 2 3 44 55 66 4 5 6 92 48 33 .....................etc.................. b.txt keyfield1... (2 Replies)
Discussion started by: manas_ranjan
2 Replies

9. AIX

Can't alter bootlist

Made a sysback tape backup on our 595 running 4.1.5 but when trying to do a restore discovered that rmt0 not in bootlist(s). Tried to alter both the normal and service bootlists but system wont respond to F7(commit). Erased the service boolist then tried alter again, same result. Now have... (2 Replies)
Discussion started by: mooshkie
2 Replies
Login or Register to Ask a Question