Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Need to modify a delimited file using UNIX commands. Please find description Post 302783823 by ankurgoyal2408 on Thursday 21st of March 2013 04:10:50 AM
Old 03-21-2013
Need to modify a delimited file using UNIX commands. Please find description

i have a '|' delimited file having 4 fields.
now i want to sort the data by combination of first three fields without changing order of 4th field.
input file looks like this:

Code:
3245|G|kop|45
1329|A|uty|76
9878|K|wer|12
3245|G|kop|15
1329|A|uty|56
9878|K|wer|2
3245|G|kop|105
1329|A|uty|506
9878|K|wer|20
3245|B|aop|15
1329|M|aty|56
9878|J|aer|2

now i want to have some modification of sorting that output file shoul look like:

Code:
3245|G|kop|45
3245|G|kop|15
3245|G|kop|105
1329|A|uty|76
1329|A|uty|56
1329|A|uty|506
9878|K|wer|12
9878|K|wer|2
9878|K|wer|20
3245|B|aop|15
1329|M|aty|56
9878|J|aer|2

Please Help. i am not getting desired output after many tries.

Last edited by Scrutinizer; 03-21-2013 at 05:41 AM.. Reason: code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Converting Tab delimited file to Comma delimited file in Unix

Hi, Can anyone let me know on how to convert a Tab delimited file to Comma delimited file in Unix Thanks!! (22 Replies)
Discussion started by: charan81
22 Replies

2. UNIX for Dummies Questions & Answers

Unix Find commands

thank you for the help (1 Reply)
Discussion started by: scooter17
1 Replies

3. UNIX for Advanced & Expert Users

How to modify an existing pdf with unix shell commands

Hi, I know that to create a pdf file I can use the txt2pdf command. But if I would change an existing pdf file, by inserting lines in particular positions of this file, what can I use? And How? (3 Replies)
Discussion started by: fandwick
3 Replies

4. UNIX for Advanced & Expert Users

Using FTP to check whether file is completely FTP... plz find the description below

Hi, We have some clients who will place huge files in to one of the remote server. And the shell script written in our local server to retrieve client files (using FTP) placed on one of the remote server of ours by clients. My question Is there any FTP command/script to check from my local... (1 Reply)
Discussion started by: nmsrao
1 Replies

5. UNIX for Dummies Questions & Answers

Please help me to find the functions for description

i have taken a screen shot of the question. http://www.magicscreenshot.com/MagicScreenshot/REAdbT956kE.png Please some one help me.:) (1 Reply)
Discussion started by: kjamsheed
1 Replies

6. UNIX for Advanced & Expert Users

I need help to find some unix commands

Hey everyone, I need some help for some unix commands. - List all processes in the file "ProcessUser.txt" sorted by the users and in the file "ProcessName.txt" sorted by the name of the process. - How much time does the command "ls -alR /" need and compared to that, how much time is... (2 Replies)
Discussion started by: ZOCKER3000
2 Replies

7. Programming

Where to find sources of UNIX commands???

Dear friends, I believe that all unix commands are programs which are written in c language, please correct me if I am wrong. Now suppose that I want to see the c source of common commands like echo, ls, mkdir etc, where I can I find the source, linux is open source I believe, so the source for... (2 Replies)
Discussion started by: gabam
2 Replies

8. Shell Programming and Scripting

Help me to find a solution using UNIX commands

I have the below requirement. below is the content of the input file and my expected result Input file: a.txt <?xml version="1.0" encoding="UTF-8"?> <Employee> <Name>XXXX</Name> <ID>1233</ID> </Employee> <?xml version="1.0" encoding="UTF-8"?> <Employee> <Name>YYYY</Name> <ID>1345</ID>... (2 Replies)
Discussion started by: kmanivan82
2 Replies

9. Shell Programming and Scripting

Modify comma delimited file columns.

Please help me to update a file which contains date values as below:- From:- "1912108",20161130,"2016-12-01-00.00.00.000000","2016-12-01-08.37.12.000000" "1912108",20161201,"2016-12-02-00.00.00.000000","2016-12-02-08.28.22.000000" To:- "1912108",2016-11-30,"2016-12-01... (7 Replies)
Discussion started by: KrishnaVM
7 Replies

10. Shell Programming and Scripting

Find and modify a huge file

Dear Forum, I have a rather large file with a few million lines looking like this: head -n 5 seq.txt >KF1.8.1 010011001011100010101110000000 >DF1.6.1 0101000010111010101011111100 >XC1.3.7 010110101011101010110000011 >GG5.1.1 0100011010111010101110001101 >HK1.2.2... (5 Replies)
Discussion started by: GDC
5 Replies
CRYPTO(4)						   BSD Kernel Interfaces Manual 						 CRYPTO(4)

NAME
crypto, cryptodev -- user-mode access to hardware-accelerated cryptography SYNOPSIS
device crypto device cryptodev #include <sys/ioctl.h> #include <sys/time.h> #include <crypto/cryptodev.h> DESCRIPTION
The crypto driver gives user-mode applications access to hardware-accelerated cryptographic transforms, as implemented by the opencrypto(9) in-kernel interface. The /dev/crypto special device provides an ioctl(2) based interface. User-mode applications should open the special device, then issue ioctl(2) calls on the descriptor. User-mode access to /dev/crypto is controlled by three sysctl(8) variables, kern.userasymcrypto and kern.cryptodevallowsoft. See sysctl(7) for additional details. The crypto device provides two distinct modes of operation: one mode for symmetric-keyed cryptographic requests, and a second mode for both asymmetric-key (public-key/private-key) requests, and for modular arithmetic (for Diffie-Hellman key exchange and other cryptographic proto- cols). The two modes are described separately below. THEORY OF OPERATION
Regardless of whether symmetric-key or asymmetric-key operations are to be performed, use of the device requires a basic series of steps: 1. Open a file descriptor for the device. See open(2). 2. If any symmetric operation will be performed, create one session, with CIOCGSESSION. Most applications will require at least one sym- metric session. Since cipher and MAC keys are tied to sessions, many applications will require more. Asymmetric operations do not use sessions. 3. Submit requests, synchronously with CIOCCRYPT (symmetric) or CIOCKEY (asymmetric). 4. Destroy one session with CIOCFSESSION. 5. Close the device with close(2). SYMMETRIC-KEY OPERATION The symmetric-key operation mode provides a context-based API to traditional symmetric-key encryption (or privacy) algorithms, or to keyed and unkeyed one-way hash (HMAC and MAC) algorithms. The symmetric-key mode also permits fused operation, where the hardware performs both a privacy algorithm and an integrity-check algorithm in a single pass over the data: either a fused encrypt/HMAC-generate operation, or a fused HMAC-verify/decrypt operation. To use symmetric mode, you must first create a session specifying the algorithm(s) and key(s) to use; then issue encrypt or decrypt requests against the session. Algorithms For a list of supported algorithms, see crypto(7) and crypto(9). IOCTL Request Descriptions CRIOGET int *fd Clone the fd argument to ioctl(2), yielding a new file descriptor for the creation of sessions. CIOCFINDDEV struct crypt_find_op *fop struct crypt_find_op { int crid; /* driver id + flags */ char name[32]; /* device/driver name */ }; If crid is -1, then find the driver named name and return the id in crid. If crid is not -1, return the name of the driver with crid in name. In either case, if the driver is not found, ENOENT is returned. CIOCGSESSION struct session_op *sessp struct session_op { u_int32_t cipher; /* e.g. CRYPTO_DES_CBC */ u_int32_t mac; /* e.g. CRYPTO_MD5_HMAC */ u_int32_t keylen; /* cipher key */ void * key; int mackeylen; /* mac key */ void * mackey; u_int32_t ses; /* returns: ses # */ }; Create a new cryptographic session on a file descriptor for the device; that is, a persistent object specific to the chosen privacy algorithm, integrity algorithm, and keys specified in sessp. The special value 0 for either privacy or integrity is reserved to indicate that the indicated operation (privacy or integrity) is not desired for this session. Multiple sessions may be bound to a single file descriptor. The session ID returned in sessp->ses is supplied as a required field in the symmetric-operation structure crypt_op for future encryption or hashing requests. For non-zero symmetric-key privacy algorithms, the privacy algorithm must be specified in sessp->cipher, the key length in sessp->keylen, and the key value in the octets addressed by sessp->key. For keyed one-way hash algorithms, the one-way hash must be specified in sessp->mac, the key length in sessp->mackey, and the key value in the octets addressed by sessp->mackeylen. Support for a specific combination of fused privacy and integrity-check algorithms depends on whether the underlying hardware supports that combination. Not all combinations are supported by all hardware, even if the hardware supports each operation as a stand-alone non-fused operation. CIOCCRYPT struct crypt_op *cr_op struct crypt_op { u_int32_t ses; u_int16_t op; /* e.g. COP_ENCRYPT */ u_int16_t flags; u_int len; caddr_t src, dst; caddr_t mac; /* must be large enough for result */ caddr_t iv; }; Request a symmetric-key (or hash) operation. The file descriptor argument to ioctl(2) must have been bound to a valid session. To encrypt, set cr_op->op to COP_ENCRYPT. To decrypt, set cr_op->op to COP_DECRYPT. The field cr_op->len supplies the length of the input buffer; the fields cr_op->src, cr_op->dst, cr_op->mac, cr_op->iv supply the addresses of the input buffer, output buffer, one-way hash, and initialization vector, respectively. CIOCCRYPTAEAD struct crypt_aead *cr_aead struct crypt_aead { u_int32_t ses; u_int16_t op; /* e.g. COP_ENCRYPT */ u_int16_t flags; u_int len; u_int aadlen; u_int ivlen; caddr_t src, dst; caddr_t aad; caddr_t tag; /* must be large enough for result */ caddr_t iv; }; The CIOCCRYPTAEAD is similar to the CIOCCRYPT but provides additional data in cr_aead->aad to include in the authentication mode. CIOCFSESSION u_int32_t ses_id Destroys the /dev/crypto session associated with the file-descriptor argument. CIOCNFSESSION struct crypt_sfop *sfop; struct crypt_sfop { size_t count; u_int32_t *sesid; }; Destroys the sfop->count sessions specified by the sfop array of session identifiers. ASYMMETRIC-KEY OPERATION Asymmetric-key algorithms Contingent upon hardware support, the following asymmetric (public-key/private-key; or key-exchange subroutine) operations may also be avail- able: Algorithm Input parameter Output parameter Count Count CRK_MOD_EXP 3 1 CRK_MOD_EXP_CRT 6 1 CRK_DSA_SIGN 5 2 CRK_DSA_VERIFY 7 0 CRK_DH_COMPUTE_KEY 3 1 See below for discussion of the input and output parameter counts. Asymmetric-key commands CIOCASYMFEAT int *feature_mask Returns a bitmask of supported asymmetric-key operations. Each of the above-listed asymmetric operations is present if and only if the bit position numbered by the code for that operation is set. For example, CRK_MOD_EXP is available if and only if the bit (1 << CRK_MOD_EXP) is set. CIOCKEY struct crypt_kop *kop struct crypt_kop { u_int crk_op; /* e.g. CRK_MOD_EXP */ u_int crk_status; /* return status */ u_short crk_iparams; /* # of input params */ u_short crk_oparams; /* # of output params */ u_int crk_pad1; struct crparam crk_param[CRK_MAXPARAM]; }; /* Bignum parameter, in packed bytes. */ struct crparam { void * crp_p; u_int crp_nbits; }; Performs an asymmetric-key operation from the list above. The specific operation is supplied in kop->crk_op; final status for the operation is returned in kop->crk_status. The number of input arguments and the number of output arguments is specified in kop->crk_iparams and kop->crk_iparams, respectively. The field crk_param[] must be filled in with exactly kop->crk_iparams + kop->crk_oparams arguments, each encoded as a struct crparam (address, bitlength) pair. The semantics of these arguments are currently undocumented. SEE ALSO
aesni(4), hifn(4), ipsec(4), padlock(4), safe(4), ubsec(4), crypto(7), geli(8), crypto(9) HISTORY
The crypto driver first appeared in OpenBSD 3.0. The crypto driver was imported to FreeBSD 5.0. BUGS
Error checking and reporting is weak. The values specified for symmetric-key key sizes to CIOCGSESSION must exactly match the values expected by opencrypto(9). The output buffer and MAC buffers supplied to CIOCCRYPT must follow whether privacy or integrity algorithms were specified for session: if you request a non-NULL algorithm, you must supply a suitably-sized buffer. The scheme for passing arguments for asymmetric requests is baroque. The naming inconsistency between CRIOGET and the various CIOC* names is an unfortunate historical artifact. BSD
December 12, 2014 BSD
All times are GMT -4. The time now is 05:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy