You know the drill, what have you tried yourself?
You could:
1) use read line, 'ignore' the first line, and then do checks on every later line (num)
2) use some awk
Thank you
Thank you very much for your kind replay;
I successfully compared these values and bash returned with the right comparison results. The problem is I cannot do the replacement inside awk. Do you have some ideas for this?
Hi,
I am trying to write a script to extract multiple sets of data from a chemistry output file. The problem section is in the following format...
Geometry "geometry" -> "geometry"
1 Pd 46.0000 -0.19290971 0.00535260 0.02297606
2 P ... (7 Replies)
Hi,
I' using bash and I would like to use "bc" to compute the ratio of of two numbers and assign the ratio to a variable.
The numbers are in a file, e.g.
196.304492
615.348986
Any idea how to do it?
N.B. I cannot change the file to have 196.304492 / 615.348986 as the file is produced by... (14 Replies)
Hello,
I really would appreciate some help with a bash script for some string manipulation on an SQL dump:
I'd like to be able to rename "sites/WHATEVER/files" to "sites/SOMETHINGELSE/files" within the sql dump.
This is quite easy with sed:
sed -e... (1 Reply)
Hello folks
I Hope everyone is fine. I am calculating number of bytes calculation from apache web log.
awk '{ sum += $10 } END { print sum }' /var/httpd/log/mydomain.log
7.45557e+09
it show above number, what should i do it sow number like 7455, i mean if after decimal point above 5 it... (5 Replies)
Hi !
How to increment a varibale in ksh.
#!/bin/ksh
set -x
RELEASE_NUM=5.2.103
VAL=0.0.1
RELEASE_NUM=`echo $RELEASE_NUM + $VAL | bc`
echo $RELEASE_NUM
The above code is throwing this error.
+ RELEASE_NUM=5.2.103 (2 Replies)
Hi All,
I have a problem to find number of lines per column smaller than the values given in a different file. In example, compare the 1st column of file1 with the 1st line of the file2, 2nd column of file1 with the 2nd line of the file2, etc
cat file1
0.2 0.9 0.8 0.5 ...
0.6 0.5... (9 Replies)
I have a number, which I want to convert into the nearest floating number upto two places after the decimal point.
E.g.
1.2346 will become 1.23
but
1.2356 will become 1.24 .
Similarly
0.009 will be 0.01
and
0.001 will be 0.00 or 0.0 (not 0, wnat to keep the decimal... (1 Reply)
Hello Guys,
I have a floating point number 1.14475E+15 I want to convert this number in to full number (Integer or Big integer). I tried couple of functions it did not work. When I use INT=${FLOAT/.*} I am getting value as 1. I don't want a truncated value
#!/bin/bash
#... (9 Replies)
Hello, I have two edgelists. One bigger list master.txt and a subset of that, child.txt. I want to print out all the edges in master.txt which is not there in child.txt. I have done it the Python way, but its taking way to much time as the number of edges are huge. (one thing is that A-B and B-A... (7 Replies)
Discussion started by: Sanchari
7 Replies
LEARN ABOUT SUNOS
cmp
cmp(1) User Commands cmp(1)NAME
cmp - compare two files
SYNOPSIS
cmp [-l] [-s] file1 file2 [skip1] [skip2]
DESCRIPTION
The cmp utility compares two files. cmp will write no output if the files are the same. Under default options, if they differ, it writes to
standard output the byte and line numbers at which the first difference occurred. Bytes and lines are numbered beginning with 1. If one
file is an initial subsequence of the other, that fact is noted. skip1 and skip2 are initial byte offsets into file1 and file2 respec-
tively, and may be either octal or decimal; a leading 0 denotes octal.
OPTIONS
The following options are supported:
-l Write the byte number (decimal) and the differing bytes (octal) for each difference.
-s Write nothing for differing files; return exit statuses only.
OPERANDS
The following operands are supported:
file1 A path name of the first file to be compared. If file1 is -, the standard input will be used.
file2 A path name of the second file to be compared. If file2 is -, the standard input will be used.
If both file1 and file2 refer to standard input or refer to the same FIFO special, block special or character special file, an error
results.
USAGE
See largefile(5) for the description of the behavior of cmp when encountering files greater than or equal to 2 Gbyte (2**31 bytes).
EXAMPLES
Example 1: Comparing files byte for byte
The following example:
example% cmp file1 file2 0 1024
does a byte for byte comparison of file1 and file2. It skips the first 1024 bytes in file2 before starting the comparison.
ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of cmp: LANG, LC_ALL, LC_CTYPE, LC_MES-
SAGES, and NLSPATH.
EXIT STATUS
The following error values are returned:
0 The files are identical.
1 The files are different; this includes the case where one file is identical to the first part of the other.
>1 An error occurred.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
|CSI |enabled |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
SEE ALSO comm(1), diff(1), attributes(5), environ(5), largefile(5), standards(5)SunOS 5.10 1 Feb 1995 cmp(1)