Sponsored Content
Top Forums Shell Programming and Scripting Difference in awk output and while Post 303008594 by apmcd47 on Monday 4th of December 2017 06:01:32 AM
Old 12-04-2017
You can also remove the filename from the output of cksum:
Code:
$ cksum file
812788392 1423 file
$ cksum < file
812788392 1423

Obviously you cannot do this if getting the checksum of multiple files.

Andrew
This User Gave Thanks to apmcd47 For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to output the difference of two files?

Hi, I had two data file (File1, File2), each one just have one column, but two file were very big. File2 is smaller, all its data included in File1. I want to ouput the result which don't have any data in File2. Could any one give me a help on how to do that? Thanks in advance! Yun ... (4 Replies)
Discussion started by: yxiao
4 Replies

2. UNIX for Dummies Questions & Answers

output difference in two files

Hi, Please help me, I have two files. I need to output the difference of contents of each file in another file. For example, I need to know the content of the file1 that does not exist on file2 and vice versa. Please take note that the size of the files are large. How can I do it using unix... (4 Replies)
Discussion started by: ayhanne
4 Replies

3. HP-UX

Difference in netstat -a and -an output.

Hi, Does anyone know why I get a different output when using "netstat -a" or "netstat -an" ?? # netstat -a | grep ts15r135 tcp 0 0 nbsol152.62736 ts15r135.23211 ESTABLISHED # netstat -an | grep 172.23.160.78 tcp 0 0 135.246.39.152.51954 ... (4 Replies)
Discussion started by: ejdv
4 Replies

4. Solaris

Difference in date output

HiCan anyone tell me why I am getting a difference in the date format on 2 different Solaris servers?On one I get: -Monday, 9 November 2009 09:02:45 GMTand the other: -Monday November 9 09:03:05 GMT 2009Both servers are running OS Version M-11/16/88iCan anyone tell me why one uses a "," and the... (5 Replies)
Discussion started by: steadyonabix
5 Replies

5. UNIX for Dummies Questions & Answers

Check for difference in output of 2 commands?

Hello! I'm just learning the shell, and I would really like to know how to do this: Given these 2 commands: ls -l ls -le How can I, with a one-liner, ask the shell to show me visually in the shell, what the difference is between the output of the two commands? They look the same to me... (6 Replies)
Discussion started by: turbofayce
6 Replies

6. Shell Programming and Scripting

Compare two files and output difference, by first field using awk.

It seems like a common task, but I haven't been able to find the solution. vitallog.txt 1310,John,Hancock 13211,Steven,Mills 122,Jane,Doe 138,Thoms,Doe 1500,Micheal,May vitalinfo.txt 12122,Jane,Thomas 122,Janes,Does 123,Paul,Kite **OUTPUT** vitalfiltered.txt 12122,Jane,Thomas... (2 Replies)
Discussion started by: charles33
2 Replies

7. Shell Programming and Scripting

Need script to output difference in folders

Hey everyone, I have two folders (folder1, folder2). Folder2 is a compiled version of a bunch of other folders including folder1. I want to compare folder1 to folder2 to make sure that folder2 contains all of the contents of folder1. If it does not, I would like the script to output... (5 Replies)
Discussion started by: chango77747
5 Replies

8. Shell Programming and Scripting

Gawk output difference

Why the below option2 doesn't fetch similar output as option1 ? I am on linux. $cat test 2013-01-01-00.25.43.643845 Option1: cat test | gawk -F"-" ' {print $2 " " $3 " " $1}' 01 01 2013 Option2: cat test | gawk '{FS="-"} {print $2 " " $3 " " $1}' 2013-01-01-00.25.43.643845 (5 Replies)
Discussion started by: Shivdatta
5 Replies

9. Shell Programming and Scripting

Difference output of files

Need help on below req Compare two files and send difference of file to other file File2 is static which never changes ex: File1 A.txt B.ttx C.txt E.txt File2 A.txt (6 Replies)
Discussion started by: satish1222
6 Replies

10. Shell Programming and Scripting

awk to calculate difference of split and sum the difference

In the awk I am trying to subtract the difference $3-$2 of each matching $4 before the first _ (underscore) and print that value in $13. I think the awk will do that, but added comments. What I am not sure off is how to add a line or lines that will add sum each matching $13 value and put it in... (2 Replies)
Discussion started by: cmccabe
2 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 12:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy