Is it possible to use awk to print all line in a file and then do a
command on a single column?
I was wondering if it is possible to print all lines in a file using AWK
and then selecting one of those columns in the file to hash that value
using this command:
openssl dgst -sha1 | sed 's/^.* //'
I am using the read command at the moment but it seems to write extremely
slow. Here's what I have at the moment:
while IFS="," read -ra line;
do
if [ "${line[1]}" != "" ]; then
echo -n "${line[*]}, Hash Value:"; echo "${line[1]}" | openssl
dgst -sha1 | sed 's/^.* //'
else
if [ "${line[1]}" == "" ]; then
echo "${line[*]}, Hash Value: None";
fi
fi
done
So I guess ultimately what I am saying is, how can I use AWK instead to
print all the line and do a command on a specific column? Looking to speed
up the process of the read. Also, is it possible to use AWK to print
columns of all files in a directory?
Thanks guys!
No comments:
Post a Comment