Using sed regex to remove the top level domain from a fully qualified domain name
Hi,
I have file contain 100 FQDN I want to remove TLD ".com, .org , .net ...." using sed regex not others, and redirect output to new file. Thanks |
Code:
echo $line | sed -e 's/\.[a-z]*$//' |
Code:
test$ cat file |
Thanks a lot it's working like sharm
Can you please describe the command |
Quote:
Code:
sed 's/\.[^.][^.]*$//' file sed 'program' input-file program enclosed in single quotes to prevent expansion by shell. format of program: s/regular-expression/replacement-string/
more information: Code:
man sed Code:
info sed HTH |
Code:
TLD's can include characters outside [a-z] |
Quote:
|
All times are GMT -5. The time now is 09:19 AM. |