The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Parse Logfile output variable Ikon Shell Programming and Scripting 11 12-12-2008 10:37 AM
To parse through the file and print output using awk or sed script cdfd123 Shell Programming and Scripting 4 03-03-2008 12:07 PM
How to parse through a file and based on condition form another output file sivasu.india UNIX for Advanced & Expert Users 6 02-28-2008 04:59 AM
parse through one text file and output many sophiadun UNIX for Dummies Questions & Answers 14 02-20-2008 06:08 AM
Parse ping output palm101 Shell Programming and Scripting 3 11-11-2007 12:16 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #8 (permalink)  
Old 01-28-2009
FreddyG FreddyG is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 7
ok, I have

Code:
IFS=":" && \
while read name fein
do
        fein=`echo -n $fein`
        echo "$name:"$(sha1sum <<< $fein)
done < raw_data.txt > hashed_data.txt
same result

Code:
first company name:179c94cf45c6e383baf52621687305204cef16f9  -
second company name:a1b42d633e975efc2f665bda21f94e419c1b6074  -
meh...
  #9 (permalink)  
Old 01-28-2009
rwuerth rwuerth is offline
Registered User
  
 

Join Date: Jan 2009
Location: Va. Beach
Posts: 64
Also, I just realized:

the "<<<" for input to sha1sum

Quote:
echo "$name:"$(sha1sum <<< $fein)
Automatically supplies a final newline!

Can you do it with a normal redirect i.e. '<' ?
  #10 (permalink)  
Old 01-28-2009
rwuerth rwuerth is offline
Registered User
  
 

Join Date: Jan 2009
Location: Va. Beach
Posts: 64
It's not pretty, but maybe this will work:

Code:
echo "$name:"$(echo -n $fein | sha1sum)

Last edited by rwuerth; 01-28-2009 at 01:06 PM.. Reason: removed extraneous ')' from code example
  #11 (permalink)  
Old 01-28-2009
FreddyG FreddyG is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 7
I think we have it!

Code:
IFS=":" && \
while read name fein
do
        echo "$name:"$(echo -n $fein | sha1sum)
done < raw_data.txt > hashed_data.txt
  #12 (permalink)  
Old 01-28-2009
FreddyG FreddyG is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 7
YUP, that got it! Thanks so much for your help everybody
Sponsored Links
Closed Thread

Bookmarks

Tags
awk, awk trim, bash, csv, md5sum, sha1sum, trim, trim awk

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:15 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0