05-21-2008
matching numbers
hi all
I have a 2 files. both the files have some numbers and i want to find out each number in file1 is existing or not in file2. if not then put it into new file. if yes then also in a seperate file
i can not use diff command as the files are different and no order has been defined.
please help
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Howdy experts,
We have some ranges of number which belongs to particual group as below.
GroupNo StartRange EndRange
Group0125 935300 935399
Group2006 935400 935476
937430 937459
Group0324 935477 935549
... (6 Replies)
Discussion started by: thepurple
6 Replies
2. Shell Programming and Scripting
Hello all,
can you help me in this problem, assume We have two txt file (file_1 and file_3) one is file_1 contains the data:
a 0
b 1
c 3
a 7
b 4
c 5
b 8
d 6
.
.
.
.
and I need to count the lines with the matching data (a,b,..) and print in new file called file_2 such as the... (4 Replies)
Discussion started by: GoldenFalcon10
4 Replies
3. Shell Programming and Scripting
Hi friends,,
I need ur help very urgently.I have 2 files which have more than 5000 numbers,I want to find the matching numbers between 2 files using R language.I dont know how to use for loop in R.I tried to get a result,,but didnt get,
file1 is like
1061909
1162391... (1 Reply)
Discussion started by: sureshraj
1 Replies
4. UNIX for Dummies Questions & Answers
Dear all,
I'm stuck on a certain problem regarding counting the number of characters in one line and then adjusting the number of characters of another line to this number.
This was my original input data:
@HWI-ST471_57:1:1:1231:2079/2... (4 Replies)
Discussion started by: DerSeb
4 Replies
5. Shell Programming and Scripting
Hi,
I need to match up some numbers in one file to the closest numbers in other file and produce an output file.
File one (f1.txt) is laid out like this
PCode Lon Lat
AB10 1AA 57.148235 -2.096648
BB2 3JD 53.728563 -2.47852
LU4 9ET... (4 Replies)
Discussion started by: ian_gooch
4 Replies
6. Shell Programming and Scripting
Experts:
I don't know that regular expressions will ever be easy for me, so if one of you guru's could help out, I'd appreciate it.
I'm trying to match a line in our syslog, but I can't figure out how to match a number inside a bracket. This is what I'm trying to match.
"Jul 16 00:01:34... (2 Replies)
Discussion started by: jdveencamp
2 Replies
7. Shell Programming and Scripting
Hi All,
I have a file which looks like this:
abc 1
abc 2
abc 3
abc 4
abc 5
bcd 1
bcd 3
bcd 3
bcd 5
cde 7
This file is just a miniature version of what I really have. Original file is some 1 million lines long.
I have tried to come up with the code for what I wish to accomplish... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies
8. UNIX for Dummies Questions & Answers
##### (0 Replies)
Discussion started by: lucasvs
0 Replies
9. Shell Programming and Scripting
Hi,
I have one file 1.txt with one field consist of following Ids (shortlisted 10 but showing 3 here):
00052
00184
00607
and then second file 2.txt with three fields (very big file):
00052 00184 12.73062
00052 00598 13.51205
00052 00599 13.92554
00052 00600 13.73358... (2 Replies)
Discussion started by: bioinfo
2 Replies
10. Shell Programming and Scripting
Hi All,
Can some one help me in identifying the significance of character "$" ,Which is playing critical role in matching decimal point numbers as below.
$ echo "01#.01"|awk '{if ($0 ~ /^+(\.*)?$/) print}'
$ echo "01#.01"|awk '{if ($0 ~ /^+(\.*)?/) print}'
01#.01
$
Regards,
Rmkganesh. (3 Replies)
Discussion started by: rmkganesh
3 Replies
LEARN ABOUT OPENSOLARIS
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 writes 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 can 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 status only.
OPERANDS
The following operands are supported:
file1 A path name of the first file to be compared. If file1 is -, the standard input is used.
file2 A path name of the second file to be compared. If file2 is -, the standard input is 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 does a byte for byte comparison of file1 and file2:
example% cmp file1 file2 0 1024
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.11 19 Jul 2006 cmp(1)