unix - using awk to get column values and then running another command on values and printing them -


i've used stack overflow issues first post. new unix scripting , given task values of column 2 , run command on them. command suppose run 'echo -n "$2" | openssl dgst -sha1;' function hash value. problem not hashing 1 value, hashing them , printing them. can maybe me figure out? how starting think path going wrong.

note: csv text file , know need use awk command this.

awk 'begin { fs = "," } ; { print $2 }'      while [ "$2" != 0 ];               echo -n "$2" | openssl dgst -sha1      done 

this prints second column in it's entirety , print type of hashed value.

sorry long first post, trying specific possible. thanks!

you don't need awk extracting second column. can using bash read built in , setting ifs delimiter.

while ifs=, read -ra line; [[ ${line[1]} != 0 ]] && echo "${line[1]}" | openssl dgst -sha1 done < inputfile 

you should post sample input data , error getting can debug existing code better.


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -