Search Results

Search: Posts Made By: stevesmith
13,315
Posted By stevesmith
Compare
My bad,

My problem was with this line which had an extra filename in the piped grep:
grep -w $a file2 |grep -w $b file2 >/dev/null

Should be like you said which works perfectly.

grep -w $a...
13,315
Posted By stevesmith
Comparing
Ug. Same problem with the array and the grep. If I have the following:

File1:
222 666

File2:
222 111 333
756 666 000

The entry for 222 666 should be printed because it's values are on 2...
13,315
Posted By stevesmith
Comparing
Got it!

This works.

grep -w $a 2 |grep -w $b 2 >/dev/null

Thanks very much for your help, I appreciate it!
13,315
Posted By stevesmith
Comparing
Close, very close..I made one change to allow for random order of a and b and random number of characters in each column. The only thing I can't figure out is why when it finds this it doesn't print...
13,315
Posted By stevesmith
Comparing
Thanks, this also looks promising but I'm getting a syntax error for the grep and without it the output is all the lines from file1 and file2. whereas I jsut want the lines from file1.

grep:...
13,315
Posted By stevesmith
Comparing multi columns over 2 files
Greetings folks

I've found a problem with the code, it does everything described in the original thread except it doesn't do it row by row.
For example: if i have the following files

File1...
13,315
Posted By stevesmith
Compare
The search file is the example "file 2" from my original post, the output file would be "file 1." File 1 has 2 columns to find in any row of file 2. The output of the script goes to standard out...
13,315
Posted By stevesmith
Awesome. A couple of little changes I needed...
Awesome.

A couple of little changes I needed to make for it to work exactly as I needed:

awk '
FILENAME=="searchfile" {
for(i=1;i<=NF;i++ ) {Keys[$i]++}
}
...
13,315
Posted By stevesmith
Compare multiple columns between 2 files
hello

I need to compare 2 text files. File 1 has 2 columns and file 2 has 1 to many.
Sample:

File 1:

111 555
222 666
333 777
444 755

File 2:

000 110 113 114
844 111 555...
4,121
Posted By stevesmith
Another transposing issue
Hello

I need to sort a file with data such as so it breaks on column 1 and all the data in column 2 is sorted into rows with a unique column 1:
1 5
1 6
1 7
2 3
2 4
3 7
3 0
3 9

So it...
Showing results 1 to 10 of 10

 
All times are GMT -4. The time now is 05:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy