List all files with prepended CRC32 (or other) hash code?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting List all files with prepended CRC32 (or other) hash code?
# 1  
Old 10-02-2011
List all files with prepended CRC32 (or other) hash code?

I would like to list all files in a directory tree but with a prepended digest hash code (like CRC32). CRC32 is not a MUST. If suitable another hash code can be used as well. In case of CRC32 the listing should look like

Code:
3765AC \usr\bin\spool
23CE99 \usr\bin\spool\list.h
...
11AA04 \etc\apt\sources.list

How can I achieve this?

Peter

Last edited by radoulov; 10-02-2011 at 07:11 AM.. Reason: Code tags!
# 2  
Old 10-02-2011
Code:
$ find . -type f | xargs crc32
8ffca073	./Dir1/file3
6734ef32	./Dir2/file4
2b985a52	./file1
ea7784a8	./file2

# 3  
Old 10-02-2011
Quote:
Originally Posted by scottn
Code:
$ find . -type f | xargs crc32
8ffca073    ./Dir1/file3
6734ef32    ./Dir2/file4
2b985a52    ./file1
ea7784a8    ./file2

Thank you but this gives me (under Ubuntu 11.04) the following error:

Code:
xargs: crc32: No such file or directory

I assume crc32 and/or xargs is not available here.
Any other solution?

Peter

Last edited by radoulov; 10-02-2011 at 07:12 AM.. Reason: Code tags.
# 4  
Old 10-02-2011
It's just a Perl script.

Ubuntu Manpage: crc32 - compute CRC-32 checksums for the given files

Use your Ubuntu package manager - whatever that is - to install it.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Dynamically parse BibTeX and create hash of hash

Hello gurus, Iam trying to parse following BibTex file (bibliography.bib): @book{Lee2000a, abstract = {Abstract goes here}, author = {Lee, Wenke and Stolfo, Salvatore J}, title = {{Data mining approaches for intrusion detection}}, year = {2000} } @article{Forrest1996, abstract =... (0 Replies)
Discussion started by: wakatana
0 Replies

2. Shell Programming and Scripting

Compare values of hashes of hash for n number of hash in perl without sorting.

Hi, I have an hashes of hash, where hash is dynamic, it can be n number of hash. i need to compare data_count values of all . my %result ( $abc => { 'data_count' => '10', 'ID' => 'ABC122', } $def => { 'data_count' => '20', 'ID' => 'defASe', ... (1 Reply)
Discussion started by: asak
1 Replies

3. Shell Programming and Scripting

Need to simplify code list files in directory

I have the following code that print certain files in my directory and groups things together. I would be good to tidy and simplify this code up and would greatly appreciate suggestions. if ($opt_raytrac == 1) then echo "" echo -n "\033*\)/ & /g' | sort -k 4n | sed 's/ //g' \ # |... (0 Replies)
Discussion started by: kristinu
0 Replies

4. Shell Programming and Scripting

Perl: Sorting a hash value that is a list.

Hi Folks I am very much a newbie at perl but picking it up and I'm hoping you can help. I have a file input that details all the /etc/group files in our enterprise in the following format: "<host>:<group>:<gid>:<users>" I want to parse this data display it as the following:... (9 Replies)
Discussion started by: g_string
9 Replies

5. UNIX for Dummies Questions & Answers

cksum does not give me crc32

Is cksum the right command to calculate the crc32 checksum value? I tried it for a number of files now and every time the results dont match. So there is nothing wrong with the file. Also, cksum gives me an all numerical value while crc32 is alpha numeric. What am I doing wrong? Thanks (9 Replies)
Discussion started by: utamav
9 Replies

6. Shell Programming and Scripting

Perl Hash:Can not keep hash data in the same order that it was inserted

Can Someone explain me why even using Tie::IxHash I can not get the output data in the same order that it was inserted? See code below. #!/usr/bin/perl use warnings; use Tie::IxHash; use strict; tie (my %programs, "Tie::IxHash"); while (my $line = <DATA>) { chomp $line; my(... (1 Reply)
Discussion started by: jgfcoimbra
1 Replies

7. UNIX for Advanced & Expert Users

cksum's and zip's CRC32 algorithm

Hello! For long I used cksum to find file duplicates in linux and darwin. Now I want to make my own program that does all. However I can't seem to find the correct algorithm. zip and cksum claim to use the same algorithm, but the computated sums are not the same. I've already written an... (4 Replies)
Discussion started by: regnevakrad
4 Replies

8. Shell Programming and Scripting

Print Entire hash list (hash of hashes)

I have a script with dynamic hash of hashes , and I want to print the entire hash (with all other hashes). Itried to do it recursively by checking if the current key is a hash and if yes call the current function again with refference to the sub hash. Most of the printing seems to be OK but in... (1 Reply)
Discussion started by: Alalush
1 Replies

9. Shell Programming and Scripting

getting data list into a hash array

Begginer alert!! I have just started learning perl and have got stuck. I need to initialize a hash array with values from a list. I've been told to do this using a split command, but its just not happening. Here is the script and output: SCRIPT: #!/bin/perl system("clear"); ... (5 Replies)
Discussion started by: topcat8
5 Replies

10. Programming

crc32 info

hello again, does anyone know where i can find some detailed info about the cyclic redundancy check? thx (2 Replies)
Discussion started by: crashnburn
2 Replies
Login or Register to Ask a Question