Sponsored Content
Top Forums Shell Programming and Scripting Issues formatting output of two commands in a single line. Post 303038247 by jgt on Wednesday 28th of August 2019 10:00:25 PM
Old 08-28-2019
calculate cksum first and assign it to a variable, then print that variable in the awk statement.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Multi-line output to single line

Hello, How can I take the following output: outputa outputb outputc and turn it into single line ouput, with a single space between each field like below: outputa outputb outputc (7 Replies)
Discussion started by: LinuxRacr
7 Replies

2. Shell Programming and Scripting

single line input to multiple line output with sed

hey gents, I'm working on something that will use snmpwalk to query the devices on my network and retreive the device name, device IP, device model and device serial. I'm using Nmap for the enumeration and sed to clean up the results for use by snmpwalk. Once i get all the data organized I'm... (8 Replies)
Discussion started by: mitch
8 Replies

3. Shell Programming and Scripting

Putting multiple sed commands on a single line

Hi, I want to make sed write a part of fileA (first 7 lines) to file1 and the rest of fileA to file2 in a single call and single line in sed. If I do the following: sed '1,7w file1; 8,$w file2' fileA I get only one file named file1 plus all the characters following file1. If I try to use curly... (1 Reply)
Discussion started by: varelg
1 Replies

4. Shell Programming and Scripting

Merge multi-line output into a single line

Hello I did do a search and the past threads doesn't really solve my issue. (using various awk commands) I need to combine the output from java -version into 1 line, but I am having difficulties. When you exec java -version, you get: java version "1.5.0_06" Java(TM) 2 Runtime... (5 Replies)
Discussion started by: flagman5
5 Replies

5. UNIX for Dummies Questions & Answers

Multiple Commands on a Single Line

Hi There, I have a cronjob that executes a small script (few lines) that I am certain can be achieved in a single line. The functional objective is actually really simple; cmd var1 The '1' in 'var1' is actually derived from date (day of month) but the snag is when working with 1-9 I... (3 Replies)
Discussion started by: Random79
3 Replies

6. UNIX for Dummies Questions & Answers

Redirecting the multiple commands output to single file

Hi, I am new to shell scripting and have a question. I would like to redirect the output of multple commands to single file, From what I read from the bash manpage and from some searching it seems it cannot be done within the shell except setting up a loop. Is it? I am running all clearcase... (1 Reply)
Discussion started by: saku
1 Replies

7. Shell Programming and Scripting

Joining multi-line output to a single line in a group

Hi, My Oracle query is returing below o/p ---------------------------------------------------------- Ins trnas value a lkp1 x a lkp1 y b lkp1 a b lkp2 x b lkp2 y ... (7 Replies)
Discussion started by: gvk25
7 Replies

8. Shell Programming and Scripting

convert single line output to multiple line

Hi all, I have a single line output like below echo $ips 10.26.208.28 10.26.208.26 10.26.208.27 want to convert above single line output as below format. Pls advice how to do ? 10.26.208.28 10.26.208.26 10.26.208.27 Regards Kannan (6 Replies)
Discussion started by: kamauv234
6 Replies

9. Shell Programming and Scripting

Formatting File having big single line into 95 Char Per Line

Hi All, I have 4 big files which contains one big line containing formatted character records, I need to format each file in such way that each File will have 95 Characters per line. Last line of each file will have newline character at end. Before:- File Name:- File1.dat 102 121340560... (10 Replies)
Discussion started by: lancesunny
10 Replies

10. UNIX for Beginners Questions & Answers

Output to file print as single line, not separate line

example of problem: when I echo "$e" >> /home/cogiz/file.txt result prints to file as:AA BB CC I need it to save to file as this:AA BB CC I know it's probably something really simple but any help would be greatly appreciated. Thank You. Cogiz (7 Replies)
Discussion started by: cogiz
7 Replies
cksum(1)						      General Commands Manual							  cksum(1)

NAME
cksum - Displays the checksum and byte count of a file SYNOPSIS
cksum [file...] STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: cksum: XCU5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. OPTIONS
None OPERANDS
The path name of a file to be checked. If no file is specified, standard input is used. DESCRIPTION
The cksum command reads the files specified by the file argument and calculates a 32-bit checksum Cyclic Redundancy Check (CRC) and the byte count for each file. If no files are specified, standard input is read. The checksum, number of bytes, and file name are written to standard output. If standard input is used, no path name is printed. The cksum command can be used to compare a suspect file copied or communicated over noisy transmission lines against an exact copy of a trusted file. The comparison made by the cksum command may not be cryptographically secure; however, it is unlikely that an accidentally damaged file will produce the same checksum as the original file. [Tru64 UNIX] The cksum command uses a different algorithm than the sum command to calculate the 32-bit checksum CRC. The cksum command uses a CRC algorithm based on the Ethernet standard frame check. In addition, the sum block count is an octet count in cksum. [Tru64 UNIX] The IEEE Std 1003.2-1992 and X/Open CAE specifications require a slightly different method of calculating checksum values. To obtain these new standards, set the environment variable CMD_ENV to xpg4 as follows: export CMD_ENV=xpg4 [Tru64 UNIX] To maintain compatibility if the environment variable CMD_ENV is not set, the default action of the cksum command reports the traditional checksum values. The CRC checksum is obtained in the following way: The encoding is defined by the generating polynomial: G(x) = x^32 + x^26 + x^23 + x^22 + x^16 + x^12 + x^11 + x^10 + x^8 + x^7 + x^5 + x^4 + x^2 + x + 1 Mathematically, the CRC value corresponding to a given file is defined by the following procedure: The n bits to be evaluated are consid- ered to be the coefficients of a mod 2 polynomial M(x) of degree n-1. These n bits are the bits from the file, with the most significant bit being the most significant bit of the first octet of the file and the last bit being the least significant bit of the last octet, padded with zero bits (if necessary) to achieve an integral number of octets, followed by one or more octets representing the length of the file as a binary value, least significant octet first. The smallest number of octets capable of representing this integer is used. M(x) is multiplied by x^32 (that is, shifted left 32 bits) and divided by G(x) using mod 2 division, producing a remainder R(x) of degree less than or equal to 31. The coefficients of R(x) are considered to be a 32-bit sequence. The bit sequence is complemented and the result is the CRC. EXIT STATUS
The following exit values are returned: All files were processed successfully. An error occurred. EXAMPLES
To display the checksum and the size, in bytes, of file1 and file2, enter: cksum file1 file2 3995432187 1390 file1 3266927833 20912 file2 This output shows that the checksum of the file1 file is 3995432187 and contains 1390 bytes, and that the checksum of the file2 file is 3266927833 and contains 20912 bytes. ENVIRONMENT VARIABLES
The following environment variables affect the execution of cksum: [Tru64 UNIX] If this variable is set to xpg4, the method of calculating checksum values specified by IEEE Std 1003.2-1992 (POSIX.2) and X/Open CAE specifications is used. Provides a default value for the inter- nationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization variables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value, overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multibyte characters in arguments). Determines the locale for the format and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of LC_MESSAGES. SEE ALSO
Commands: sum(1), wc(1) Standards: standards(5) cksum(1)
All times are GMT -4. The time now is 03:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy