I have a bunch of conf files, that contain the fully qualified names of servers. I would like to be able to use some sort of pattern matching with sed or vi, or whatever, to pull out the fully qualified server names, and dump them in a file.
It just needs to work across several unix os. So, I have been using vi. That works, but it takes about 8 pattern matches to whittle the conf file down to just the fully qualified server names. And each conf file is slightly different, so the same pattern of substitutions doesn't work on all the conf files.
I can get close with just a search "[^ ]*.domain.com" in vi, but I don't want to match the names, I want to exclude them, unless I can pull all of the matches out and put them in a new file. However, I could not figure out if you can do that either...
Far better to delete everything but "[^ ]*.domain.com"
Does someone know how to do that in a substitution, or some other command?
Which I can then sort with "cat list | sort -u | sort -n > newer_list" to get a single unique list of servers .
Basically, just either extracting the server names, queing off the domain name, or delete every but the servernames. I'd make a copy of the file, and use that, of course