06-27-2013
What happens when both of them exist?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi, i've two files (file1, file2) i want to take value (in column1) and search in file2 if the they match print the value from file2.
this is what i have so far.
awk 'FILENAME=="file1"{ arr=$1 }
FILENAME=="file2"
{print $0}
' file1 file2 (2 Replies)
Discussion started by: myguess21
2 Replies
2. Shell Programming and Scripting
I have two files - file1 and file2. Now I want records in file2 those are not exist in file1. How to grep this ?
eg:
file1
08941
08944
08945
08946
08947
file2
08942 08944 5
08942 08945 5
08942 08946 4
08942 08947 6
08942 08952 4
08942 08963 5
08942 ... (3 Replies)
Discussion started by: suresh3566
3 Replies
3. Shell Programming and Scripting
Wat does this command do?
fileA is a subset of fileB..now, i need to find the lines in fileB that are not in fileA...i.e fileA - fileB.
diff fileA fileB gives the ouput but the format looks no good....
I just need the contents alone not the line num etc. (7 Replies)
Discussion started by: vijay_0209
7 Replies
4. Shell Programming and Scripting
Hello, I am new to shell scripting and i need to create a script with the following directions and I can not figure it out.
Create a shell script called newest.bash that takes two filenames as input arguments ($1 and $2) and prints out the name of the newest file (i.e. the file with the... (1 Reply)
Discussion started by: mandylynn78
1 Replies
5. Shell Programming and Scripting
Hi
I started to learn bash a week ago. I need filter the strings from the last column of a "file2" that match with a column from an other "file1"
file1:
chr10100036394-100038350AK077761
chr10100041065-100046547AK032226
chr10100041065-100046547AK016270
chr10100041065-100046547AK078231
...... (6 Replies)
Discussion started by: geparada88
6 Replies
6. Shell Programming and Scripting
Hi
I have to list of words file1 and file2, I want to compare both lists and remove from file2 all the words that don't exist in file1.
How can I do this?
Many thanks (4 Replies)
Discussion started by: noliveira
4 Replies
7. UNIX for Dummies Questions & Answers
I have very limited coding skills but I'm wondering if someone could help me with this. There are many threads about matching strings in two files, but I have no idea how to add a column from one file to another based on a matching string.
I'm looking to match column1 in file1 to the number... (3 Replies)
Discussion started by: pathunkathunk
3 Replies
8. Shell Programming and Scripting
Hi guys!
I'm trying to write something to find each line of file1 into file2, if line is found return YES, if not found return NO. The result can be written to a new file.
Can you please help me out?
FILE1 INPUT:
WATER
CAR
SNAKE
(in reality this file has about 600 lines each with a... (2 Replies)
Discussion started by: demmel
2 Replies
9. UNIX for Dummies Questions & Answers
I want to print only the lines in file2 that match file1, in the same order as they appear in file 1
file1
file2
desired output:
I'm getting the lines to match
awk 'FNR==NR {a++}; FNR!=NR && a' file1 file2
but they are in sorted order, which is not what I want:
Can anyone... (4 Replies)
Discussion started by: pathunkathunk
4 Replies
10. Shell Programming and Scripting
I am trying to use awk to find all the $2 values in file2 which is ~30MB and tab-delimited, that are between $2 and $3 in file1 which is ~2GB and tab-delimited.
I have just found out that I need to use $1 and $2 and $3 from file1 and $1 and $2of file2 must match $1 of file1 and be in the range... (6 Replies)
Discussion started by: cmccabe
6 Replies
COMM(1) User Commands COMM(1)
NAME
comm - compare two sorted files line by line
SYNOPSIS
comm [OPTION]... FILE1 FILE2
DESCRIPTION
Compare sorted files FILE1 and FILE2 line by line.
With no options, produce three-column output. Column one contains lines unique to FILE1, column two contains lines unique to FILE2, and
column three contains lines common to both files.
-1 suppress column 1 (lines unique to FILE1)
-2 suppress column 2 (lines unique to FILE2)
-3 suppress column 3 (lines that appear in both files)
--check-order
check that the input is correctly sorted, even if all input lines are pairable
--nocheck-order
do not check that the input is correctly sorted
--output-delimiter=STR
separate columns with STR
--help display this help and exit
--version
output version information and exit
Note, comparisons honor the rules specified by `LC_COLLATE'.
EXAMPLES
comm -12 file1 file2
Print only lines present in both file1 and file2.
comm -3 file1 file2
Print lines in file1 not in file2, and vice versa.
AUTHOR
Written by Richard M. Stallman and David MacKenzie.
REPORTING BUGS
Report comm bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
Report comm translation bugs to <http://translationproject.org/team/>
COPYRIGHT
Copyright (C) 2011 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
SEE ALSO
join(1), uniq(1)
The full documentation for comm is maintained as a Texinfo manual. If the info and comm programs are properly installed at your site, the
command
info coreutils 'comm invocation'
should give you access to the complete manual.
GNU coreutils 8.12.197-032bb September 2011 COMM(1)