Hi guys,
I need help in extracting one column of numbers from two different files and display it in a output file. In specific, I want to extrac the column no.2 ($2) from each file, file1.txt, file2.txt. Then place both extracted columns in a one file, out.txt.
the line command I use to... (7 Replies)
Suppose i have a file A
1*2*3*4
2*4*4*22
and second file B
2*3*4*5
4*4*6*7
By multiplying file A by file B that is file A by first column in file B respectively
output shud be
2*6*12*20
8*16*24*154
my code is
=$1
next
}
{for (f=1;f<=NF;f++) (2 Replies)
Hi,
i have file1 which looks like:
x1 y1 z1
x2 y2 z2
...(and so on)
and file2 which looks like:
a11 a12 a13
a21 a22 a23
a31 a32 a33
and i want to replace file1 with the following values:
x1' y1' z1'
x2' y2' z2'
...(and so on) (2 Replies)
Hi,
This is something that probably it is more difficult to explain than to do.
I have two files e.g.
FILE1
A15 8.3102E+00 3.2000E-04
A15 8.5688E+00 4.3000E-05
B13 5.1100E-01 1.9960E+00
B16 5.1100E-01 2.3000E-03
B16 8.6770E-01 1.0000E-07
B16 9.8693E-01 3.4000E-05... (4 Replies)
Hi,
I have 2 ASCII files, say
file1
AAAAA 3.465830E-12
BBBBB 4.263280E-08
CCCCC 1.113320E-17
DDDDD 0.000000E+00
...
file2 with as many lines as file1
3.932350E-12
1.194380E-07
4.901480E-17
0.000000E+00
3.921180E-40 (3 Replies)
I need to multiply column1 and column3 data and need to compare it with column5. Need to check multiplication and Throw error if result is greater or less than column5 values, though difference of +/- 2 will be ok
Ex - if column1 has 2.4 and column3 has 3.5, it will be ok if column5 have value... (13 Replies)
Example:
I have files in below format
file 1:
zxc,133,joe@example.com
cst,222,xyz@example1.com
File 2 Contains:
hxd
hcd
jws
zxc
cst
File 1 has 50000 lines and file 2 has around 30000 lines :
Expected Output has to be :
hxd
hcd
jws (5 Replies)
Discussion started by: TestPractice
5 Replies
LEARN ABOUT SUNOS
comm
comm(1) User Commands comm(1)NAME
comm - select or reject lines common to two files
SYNOPSIS
comm [-123] file1 file2
DESCRIPTION
The comm utility reads file1 and file2, which must be ordered in the current collating sequence, and produces three text columns as output:
lines only in file1; lines only in file2; and lines in both files.
If the input files were ordered according to the collating sequence of the current locale, the lines written will be in the collating
sequence of the original lines. If not, the results are unspecified.
OPTIONS
The following options are supported:
-1 Suppresses the output column of lines unique to file1.
-2 Suppresses the output column of lines unique to file2.
-3 Suppresses the output column of lines duplicated in file1 and file2.
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.
USAGE
See largefile(5) for the description of the behavior of comm when encountering files greater than or equal to 2 Gbyte ( 2**31 bytes).
EXAMPLES
Example 1: Printing a list of utilities specified by files
If file1, file2, and file3 each contain a sorted list of utilities, the command
example% comm -23 file1 file2 | comm -23 - file3
prints a list of utilities in file1 not specified by either of the other files. The entry:
example% comm -12 file1 file2 | comm -12 - file3
prints a list of utilities specified by all three files. And the entry:
example% comm -12 file2 file3 | comm -23 -file1
prints a list of utilities specified by both file2 and file3, but not specified in file1.
ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of comm: LANG, LC_ALL, LC_COLLATE,
LC_CTYPE, LC_MESSAGES, and NLSPATH.
EXIT STATUS
The following exit values are returned:
0 All input files were successfully output as specified.
>0 An error occurred.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWesu |
+-----------------------------+-----------------------------+
|CSI |enabled |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
SEE ALSO cmp(1), diff(1), sort(1), uniq(1), attributes(5), environ(5), largefile(5), standards(5)SunOS 5.10 3 Mar 2004 comm(1)