Sponsored Content
Top Forums Shell Programming and Scripting awk one liners into a nice script Post 302852721 by Jotne on Thursday 12th of September 2013 09:26:25 AM
Old 09-12-2013
As long as we do not have input data and desired output data, its difficult to shorten them.
 

7 More Discussions You Might Find Interesting

1. Programming

nice command and nice() system call

Hi I want to implement the nice command in the shell that I am building. I came to know that there is a corresponding nice() system call for the same. But since I will be forking different processes to run different commands typed on the command prompt, is there any way I can make a command... (2 Replies)
Discussion started by: tejbuch
2 Replies

2. UNIX for Dummies Questions & Answers

How to Turn perl one-liners into full perl script?

I have the following command prompt perl one liner: perl -e 's/\(\)\\,\"]//g; s/^\s//g; s/;/\n/g' -pi result1 I tried to move this one liner into a perl script I am practicing with (just started learning perl right now). I tried the following (I only know how to open a file and output to a... (1 Reply)
Discussion started by: EDALBNUG
1 Replies

3. Red Hat

KSH script help needed ( nice error trap routine ?)

I am running a script that runs a loop and executes a command on ${i} until the end of the for loop. From time to time the command generates an error ( which is good) for example ERROR0005: How can I trap the error and send an email echoing the ${i} variable in the loop and the error ? ... (2 Replies)
Discussion started by: pcpinkerton
2 Replies

4. Shell Programming and Scripting

awk - one liners

Guys, I have a requirement like this. A file has >5K records always. Separated by "|", it has 30 fields for each line. In some lines, I am getting an odd field. say, the 15th field is supposed to be 2 characters but comes in as >2. In this case, for resolving this I need to copy the value of... (6 Replies)
Discussion started by: PikK45
6 Replies

5. Shell Programming and Scripting

Set nice value in an executable in a script?

Is it possible to set a nice value for an executable in a script so that every time the executable runs it has this nice value? I'm trying to set aerender (After Effects terminal renderer) to run at +18 by replacing the original aerender script with a bash script with something like this in it: ... (3 Replies)
Discussion started by: scribling
3 Replies

6. What is on Your Mind?

Those simple one liners

I wanted to say LOL and punch my face when I saw post#11 (where Don_Cragun even reduced the string manipulation with a simple regex) in the thread https://www.unix.com/shell-programming-scripting/220553-add-0-start-filename-2.html I mean, when things can be done with just a one liner, sometimes I... (6 Replies)
Discussion started by: ahamed101
6 Replies

7. AIX

Useful and nice script for AIX,but outdated

How can I quickly see disk usage for my entire system? - IBM: AIX FAQ - Tek-Tips I tried it on aix7.1with ./script -dand give me VG PV size used free location Description rootvg 128 397 149 rootvg 128 212 334 ... (1 Reply)
Discussion started by: Linusolaradm1
1 Replies
des_crypt(3)						     Library Functions Manual						      des_crypt(3)

NAME
des_crypt, des_string_to_key, des_is_weak_key, des_key_sched, des_quad_cksum - Data Encryption Standard (DES) encryption library routines (Auth) SYNOPSIS
#include <des.h> int des_string_to_key( char *str, C_Block *key); int des_is_weak_key ( C_Block key); unsigned long des_quad_cksum( unsigned char *input, unsigned long *output, long length, int iterations, C_Block *seed); int des_key_sched( C_Block key, Key_schedule schedule); PARAMETERS
key For key is a pointer to a of 8-byte length. For and key is a pointer to a DES key. str A string that is converted to an 8-byte DES key. input Pointer to a block of data to which a quadratic checksum algorithm is applied. output Pointer to a pre-allocated buffer that will contain the complete output from the quadratic checksum algorithm. For each iteration of the quadratic checksum applied to the input, eight bytes (two longwords) of data are generated. length Length of the data to which the quadratic checksum algorithm will be applied. If input contains more than length bytes of data, then the quadratic checksum will only be applied to length bytes of input. iterations The number of iterations of the algorithm to apply to input. If output is NULL, then one iteration of the algorithm will be applied to input, no matter what the value of iterations is. The maximum number of iterations is four. seed An 8-byte quantity used as a seed to the input of the algorithm. schedule A representation of a DES key in a form more easily used with encryption algorithms. It is used as input to the routines. DESCRIPTION
The routines are designed to provide the cryptographic routines which are used to support authentication. Specifically, and are designed to be used with the DES key which is shared between one Kerberos principal and its authenticated peer to provide an easy authentication method after the initial Kerberos authentication pass. and are designed to enable the input and inspection of a key by a user before that key is used with the Kerberos authentication routines. The routines are not designed for general encryption. The library makes extensive use of the locally defined data types and The struct is an 8-byte block used by the various routines of the library as the fundamental unit for DES data and keys. ROUTINES string_to_key Converts a null-terminated string of arbitrary length to an 8-byte, odd-byte-parity DES key. The str argument is a pointer to the character string to be converted and key points to a C_Block supplied by the caller to receive the generated key. The one-way func- tion used to convert the string to a key makes it very difficult for anyone to reconstruct the string from the key. No meaningful value is returned. des_is_weak_key checks a new key input by a user to determine if it belongs to the well known set of DES keys which do not provide good crypto- graphic behavior. If a key passes the inspection of then it can be used with the routine. The input is a DES key and the output is equal to 1 if the key is not a safe key to use; it is equal to 0 if it is safe to use. des_quad_cksum Produces a checksum by chaining quadratic operations on cleartext data. can be used to produce a normal quadratic checksum and, if used with the DES key shared between two authenticated Kerberos principals, it can also provide for the integrity and authentication protection of data sent from one principal to another. Input of length bytes are run through the routine iterations times to produce output. If output is NULL, one iteration is performed and output is not affected. If output is not NULL, the quadratic checksum algorithm will be performed iterations times on input, placing eight bytes (two longwords) of result in output for each iteration. At all times, the low-order bits of the last quadratic checksum algorithm pass are returned by The quadratic checksum algorithm performs a checksum on a few bytes of data and feeds the result into the algorithm as an addition input to the checksum on the next few bytes. The seed serves as the additional input for the first checksum operation and, there- fore, the final checksum that results depends upon the seed input into the algorithm. If the DES key shared between two Kerberos principals is used as the initial seed, then since the checksum that results depends upon the seed, the ability to produce the checksum proves identity and authentication. Also, since the message cannot be altered without knowledge of the seed, it also pro- vides for data integrity. des_key_sched is used to convert the key input into a new format that can be used readily with encryption functions. The result, schedule, can be used with the functions to enable mutual authentication of two Kerberos principals. A 0 is returned from if successful. A -1 is returned if the each byte of the key does not have odd parity. A -2 is returned if the key is a weak key as defined by delim off des_crypt(3)
All times are GMT -4. The time now is 08:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy