Question: I would like to combine entries from the second field from two files using awk, sed or similar.

File0:

```
string:data:moredata

```

File1:

```
string:random:moredata

```

If the first field, **string** in *file0* has a matching entry in *file1* then print 

```
$random:$data

```

Selecting the fields seems trivial:

```
$ awk -F':' '{print $2}' filename

```

Need to match rows and print matching column $2

Answer: 
This `sed` solution might work for you:

```
# cat file1
string0:data1:moredata
string2:data3:moredata
string4:data5:moredata
string6:data7:moredata
string8:data9:moredata
# cat file2
string0:random1:moredata
string2:random3:moredata
string4:random5:moredata
cat file1 - <<<"EOF" file2 | 
sed '1,/^EOF/{H;d};G;s/^\([^:]*:\)\([^:]*:\).*\1\([^:]*\).*/$\2$\3/p;d'
$random1:$data1
$random3:$data3
$random5:$data5

```

Explanation:

Concatenate the files with an `EOF` delimiter. Slurp the first file into the hold space (HS). Append the HS to all lines in the second file making a lookup table. Use grouping and backreferences to substitute the required output result. BTW were the `$`'s in `$random:$data` intended?

This solution might also be made more efficient by only retaining the necessary data in the lookup and each line of file2.
`join - join lines of two files on a common field`

So do your awk thing, only print both the data and the "key" field. Then do a join command similar to: `join -1 1 -2 1 file1 file2 > joined.dat`