You might want to consider an alternative approach. No sprintf() calls, no for loops to gather your keys, and no long lists of explicitly copied arguments; just a single substr() call. And, it doesn't care how many input fields are in your keys.
If file is a file that contains slightly modified versions of your two input samples:
it produces the output:
If someone wants to try this on a Solaris/SunOS system, change awk in this script to /usr/xpg4/bin/awk or nawk.
Obviously, you can convert my suggestion to a 1-liner; but I'll take this more readable, more easily maintained version of the code over a 1-liner any day.
This User Gave Thanks to Don Cragun For This Post:
I'm working on formatting some attendance data to meet a vendors requirements to upload to their system. With some help on the forums here, I have the data close. But they've since changed what they want.
The vendor wants me to submit three fields to them. Field 1 is the studentid field,... (4 Replies)
i have this variable:
varT="1--2--3--5"
i want to use awk to print field 3 from this variable. i dont want to do the "echo $varT".
but here's my awk code:
awk -v valA="$varT" "BEGIN {print valA}"
this prints the entire line. i feel like i'm so close to getting what i want. i... (4 Replies)
Hi All,
I am looking for an awk script to do the following
Join the fields together only if the first 4 fields are same.
Can it be done with join function in awk??
a,b,c,d,8,,,
a,b,c,d,,7,,
a,b,c,d,,,9,
a,b,p,e,8,,,
a.b,p,e,,9,,
a,b,p,z,,,,9
a,b,p,z,,8,,
desired output:
... (1 Reply)
Hi experts,
I need to print the first field first then last two fields should come next and then i need to print rest of the fields.
Input :
a1,abc,jsd,fhf,fkk,b1,b2
a2,acb,dfg,ghj,b3,c4
a3,djf,wdjg,fkg,dff,ggk,d4,d5
Expected output:
a1,b1,b2,abc,jsd,fhf,fkk... (6 Replies)
Hi,
I am trying to do this:-
FILE=application.log
PID=12345
FILE=`echo $FILE | awk -F "." '{print $1 "$PID" $2}'`
echo $FILE
application$PIDlog
I need the output to be application12345.log but I am not sure how to get the $PID variable into the output. I have tried various things... (3 Replies)
I'm trying to compare 2 files for differences in a selct number of fields. When differnces are found it will write the whole record of the second file including appending '|C' out to a delta file. Each record will have 20 fields, but only want to do comparison of 1st 15 fields. The 1st field of... (7 Replies)
Hy!
I need to post-process some data files which have variable (and periodic) number of fields. For example, I need to square (data -> data*data) the folowing data file: -5.34281E-28 -3.69822E-29 8.19128E-29 9.55444E-29 8.16494E-29 6.23125E-29
4.42106E-29 2.94592E-29 1.84841E-29 ... (5 Replies)
Hi
I have a file as below
<field1> <field2> <field3> ... <field_num1> <field_num2>
Trying to sort based on difference of <field_num1> and <field_num2> in desceding order and print all fields.
I tried this and it doesn't sort on the difference field .. Appreciate your help.
cat... (9 Replies)
In the below awk if I use the attached file as the input, I get no results for TCF4. However, if I just copy that line from the attached file and use that as input I get results for TCF4.
Basically the gene file is a 1 column list that is used to filter $8 of the attached file. When there is a... (9 Replies)
Below is my ksh shell script where I need to check if variable fileprops is a subset of $1 argument.
echo "FILE PROPERTY: $fileprops"
echo "PARAMETER3: $1"
if ; then
echo "We are Good. $line FILE is found to be INTACT !! "
else
echo... (2 Replies)
Discussion started by: mohtashims
2 Replies
LEARN ABOUT CENTOS
cryptoflex-tool
CRYPTOFLEX-TOOL(1) OpenSC Tools CRYPTOFLEX-TOOL(1)NAME
cryptoflex-tool - utility for manipulating Schlumberger Cryptoflex data structures
SYNOPSIS
cryptoflex-tool [OPTIONS]
DESCRIPTION
cryptoflex-tool is used to manipulate PKCS data structures on Schlumberger Cryptoflex smart cards. Users can create, list and read PINs and
keys stored on the smart card. User PIN authentication is performed for those operations that require it.
OPTIONS --app-df num, -a num
Specifies the DF to operate in
--create-key-files arg, -c arg
Creates new RSA key files for arg keys
--create-pin-files id, -P id
Creates new PIN file for CHVid
--exponent exp, -e exp
Specifies the RSA exponent, exp, to use in key generation. The default value is 3.
--generate-key, -g
Generate a new RSA key pair
--key-num num, -k num
Specifies the key number to operate on. The default is key number 1.
--list-keys, -l
Lists all keys stored in a public key file
--modulus-length length, -m length
Specifies the modulus length to use in key generation. The default value is 1024.
--prkey-file id, -p id
Specifies the private key file id, id, to use
--pubkey-file id, -u id
Specifies the public key file id, id, to use
--read-key
Reads a public key from the card, allowing the user to extract and store or use the public key
--reader num, -r num
Forces cryptoflex-tool to use reader number num for operations. The default is to use reader number 0, the first reader in the system.
--verbose, -v
Causes cryptoflex-tool to be more verbose. Specify this flag several times to enable debug output in the opensc library.
--verify-pin, -V
Verifies CHV1 before issuing commands
SEE ALSO pkcs15-tool(1)opensc 06/17/2014 CRYPTOFLEX-TOOL(1)