shell - Bash. Get intersection from multiple files -


so let me explain bit more:

i have directory called tags has file each tag, like:

tags/     t1     t2     t3 

in each of tag files structure like:

<inode> <filename> <filepath> 

of course, each tag file have list of many files tag (but file can appear in 1 tag file once). , file may in multiple tag files.

what want able call command like

tags <t1> <t2>  

and have list files have both tags t1 , t2 in nice way.

my plan right make temp file. output entire file of t1 it. run through each line in t2 , awk on file. , keep doing that.

but wondering if has other ways. not overly familiar awk, grep etc.

can use

sort t1 t2 | uniq -d 

this combine 2 files, sort them, , display lines appear more once: is, ones appear in both files.

this assumes each file contains no duplicates within it, , inodes same in structures particular file.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -