11-04-2010
Finding differences between 2 text files
Hi everyone,
I know that's a deep treated issue but I'm actually not able to find the solution. I have 2 plain text files with ~ 2000 rows and ~5 columns. The first column of the shortest file (f1) is fully contained by the first column of the biggest one (f2), but only that column. I want to create a third file that would contain all the rows which first column is in f2 but not in f1. I mean:
f1:
aa 111 111
f2:
aa 555 555
bb 666 666
cc 777 777
f3:
bb 666 666
cc 777 777
I've tried to do it with GREP but it doesn't work (I think it's too much sensitive to the spaces so the f3 is not complete). Exactly, what I tried was:
grep -f f1 -v -w f2 > out.list and many others variants like without -w, with -E, -F...
Any ideas?
PS: sorry because of my latenight English, it's kind a late here in Spain
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
"diff" command takes two file names as arguements and gives the difference between the two.
How do I get the number of differences between two files ???
(Excluding whitespaces).
Don't ask me to count number of lines produced by "diff".
Thanks in advance,
Sharath (4 Replies)
Discussion started by: sharuvman
4 Replies
2. Shell Programming and Scripting
Hi,
I have a challenging task,in which i have to find the duplicate files by its name and size,then i need to take anyone of the file.Then i need to open the file and find for more than one pattern and count of that pattern.
Note:These are the samples of two files,but i can have more... (2 Replies)
Discussion started by: jerome Sukumar
2 Replies
3. Solaris
I want to find the difference between two jar files sitting on a sun box. How do I do this? (3 Replies)
Discussion started by: runnerpaul
3 Replies
4. Shell Programming and Scripting
Hi experts,
I'mvery new to shell scripting and learning it now
currently i am having a problem which may look easy to u :)
i have two files
File 1:
Start :Thu Nov 19 10:33:09 2009
ABCDGFSDJ.txt
APDemoNew.ppt
APDemoOutline.doc
ARDemoNew.ppt
ARDemoOutline.doc
File 2:
Start... (10 Replies)
Discussion started by: CelvinSaran
10 Replies
5. Shell Programming and Scripting
All,
I have two csv files, the format of which are exactly the same.
I would like to find differences between the two files but would like to identify the difference as opposed to just printing a different line.
For exmaple
File 1
xxx,yyy,zzz,1,2,3
111,222,333,xxx,yyy
... (4 Replies)
Discussion started by: pxy2d1
4 Replies
6. Shell Programming and Scripting
Hi
Hope you are having a great weeknd !! I had a question and need your expertise for this :
I have 2 files File1 & File2(of same structure) which I need to compare on some columns. I need to find the values which are there in File2 but not in File 1 and put the Differences in another file... (5 Replies)
Discussion started by: newbie_8398
5 Replies
7. UNIX for Dummies Questions & Answers
Hi
i have gone through some sdiff command it shows the differences side by side and its really awesome
file 1:
this tool is for
checking the differ
merging with flower pots documentation
file 2:
this t ool is for
checking the differ
mergin g with flower pots documentation
... (27 Replies)
Discussion started by: rakeshkumar
27 Replies
8. Shell Programming and Scripting
HI ,
There are more than 100 zip files in a directory and i wanted to see if there is a max1157.txt file in any of the zip files without actually unzipping them. Could you please help. Thanks in Advance.
Karthik. (6 Replies)
Discussion started by: karthikk0508
6 Replies
9. Shell Programming and Scripting
Hallo Everyone.
I have to admit I'm shell scripting illiterate . I need to find certain strings in several text files and replace each of the string by unique & corresponding text.
I prepared a csv file with 3 columns: <filename>;<old_pattern>;<new_pattern>
... (5 Replies)
Discussion started by: gordom
5 Replies
10. Shell Programming and Scripting
This seems pretty simple, but I cant figure it out. I get stumped on the simple things.
I am running two commands
1) take a listing a directory of files, and filter out the doc_name (which is in a series of extracted files), and place it in a file.
ls -l | awk '{print $9}' | grep... (5 Replies)
Discussion started by: jeffs42885
5 Replies
sgels.f(3) LAPACK sgels.f(3)
NAME
sgels.f -
SYNOPSIS
Functions/Subroutines
subroutine sgels (TRANS, M, N, NRHS, A, LDA, B, LDB, WORK, LWORK, INFO)
SGELS solves overdetermined or underdetermined systems for GE matrices
Function/Subroutine Documentation
subroutine sgels (characterTRANS, integerM, integerN, integerNRHS, real, dimension( lda, * )A, integerLDA, real, dimension( ldb, * )B,
integerLDB, real, dimension( * )WORK, integerLWORK, integerINFO)
SGELS solves overdetermined or underdetermined systems for GE matrices
Purpose:
SGELS solves overdetermined or underdetermined real linear systems
involving an M-by-N matrix A, or its transpose, using a QR or LQ
factorization of A. It is assumed that A has full rank.
The following options are provided:
1. If TRANS = 'N' and m >= n: find the least squares solution of
an overdetermined system, i.e., solve the least squares problem
minimize || B - A*X ||.
2. If TRANS = 'N' and m < n: find the minimum norm solution of
an underdetermined system A * X = B.
3. If TRANS = 'T' and m >= n: find the minimum norm solution of
an undetermined system A**T * X = B.
4. If TRANS = 'T' and m < n: find the least squares solution of
an overdetermined system, i.e., solve the least squares problem
minimize || B - A**T * X ||.
Several right hand side vectors b and solution vectors x can be
handled in a single call; they are stored as the columns of the
M-by-NRHS right hand side matrix B and the N-by-NRHS solution
matrix X.
Parameters:
TRANS
TRANS is CHARACTER*1
= 'N': the linear system involves A;
= 'T': the linear system involves A**T.
M
M is INTEGER
The number of rows of the matrix A. M >= 0.
N
N is INTEGER
The number of columns of the matrix A. N >= 0.
NRHS
NRHS is INTEGER
The number of right hand sides, i.e., the number of
columns of the matrices B and X. NRHS >=0.
A
A is REAL array, dimension (LDA,N)
On entry, the M-by-N matrix A.
On exit,
if M >= N, A is overwritten by details of its QR
factorization as returned by SGEQRF;
if M < N, A is overwritten by details of its LQ
factorization as returned by SGELQF.
LDA
LDA is INTEGER
The leading dimension of the array A. LDA >= max(1,M).
B
B is REAL array, dimension (LDB,NRHS)
On entry, the matrix B of right hand side vectors, stored
columnwise; B is M-by-NRHS if TRANS = 'N', or N-by-NRHS
if TRANS = 'T'.
On exit, if INFO = 0, B is overwritten by the solution
vectors, stored columnwise:
if TRANS = 'N' and m >= n, rows 1 to n of B contain the least
squares solution vectors; the residual sum of squares for the
solution in each column is given by the sum of squares of
elements N+1 to M in that column;
if TRANS = 'N' and m < n, rows 1 to N of B contain the
minimum norm solution vectors;
if TRANS = 'T' and m >= n, rows 1 to M of B contain the
minimum norm solution vectors;
if TRANS = 'T' and m < n, rows 1 to M of B contain the
least squares solution vectors; the residual sum of squares
for the solution in each column is given by the sum of
squares of elements M+1 to N in that column.
LDB
LDB is INTEGER
The leading dimension of the array B. LDB >= MAX(1,M,N).
WORK
WORK is REAL array, dimension (MAX(1,LWORK))
On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
LWORK
LWORK is INTEGER
The dimension of the array WORK.
LWORK >= max( 1, MN + max( MN, NRHS ) ).
For optimal performance,
LWORK >= max( 1, MN + max( MN, NRHS )*NB ).
where MN = min(M,N) and NB is the optimum block size.
If LWORK = -1, then a workspace query is assumed; the routine
only calculates the optimal size of the WORK array, returns
this value as the first entry of the WORK array, and no error
message related to LWORK is issued by XERBLA.
INFO
INFO is INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value
> 0: if INFO = i, the i-th diagonal element of the
triangular factor of A is zero, so that A does not have
full rank; the least squares solution could not be
computed.
Author:
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
November 2011
Definition at line 183 of file sgels.f.
Author
Generated automatically by Doxygen for LAPACK from the source code.
Version 3.4.2 Tue Sep 25 2012 sgels.f(3)