Text substitution and processing with sed and awk
Hey guys, I'm fairly new to this but I am looking for a way to replace text in one file based on pattern matching.
file1.txt is the result of ls -l --color=no /usr/local/mysql/data | awk '{print $4,$9}' | sort | cut -d/ -f1 > file1.txt
(note: this generates a list of about 1000 lines)
So it contains on the left a group name and on the right a database name, e.g.
vvsoccer thunder
I have another file, file2.txt, that contains all domain names on the system eg
(note: file2.txt has about 2000 domains/lines)
vvsoccersummer.com
and 1999 others, one per line.
I need to find a way to create a file3.txt that contains the domain name (from file2) and the database name.
I've tried comm -3 file1.txt file2.txt | sort but with no luck... file2.txt also contains domain names that don't necessarily have any databases in /usr/local/mysql/data
Any help or ideas would be great, i've been racking my brain for 5 hours now...
Thanks in advance for any and all input.
-Shane
|