4 deleted 60 characters in body
source | link

I have a file with Server and Domain names in it as below.

Names.txt :

ABCDomain ContractABCServer_1
ABCDomain ABC_server1
LinkDomain CoreLinkServer_1
TADDomain TADServer_1

(I'm getting above file after performing sort and unique operations to some other file.)---just additional info

I need to extract values from above file and pass it to a xyz command (the command is used to restart servers) as a parameter in below format.

O/P:

"ABCDomain(server:ContractABCServer_1,server:ABC_server1)","LinkDomain(server:CoreLinkServer_1)","TADDomain(TADServer_1)"

I m using below stated logic, but it doesn't give me the desired output as the DomainName has to come just once for each set. Also I m having trouble in keeping the same line.

-----------START------

    DOMAIN=''

IFS=' '
while read line
do
        DOMAIN=$(echo "$line" | awk -F " " '{print $1}')

        for word in $line
        do
                if [[ "$word" == "$DOMAIN" ]]; then
                        Server=$(echo "$line" | awk -F " " '{print $2}' )
                        echo -n "(server:$ServerName"
                fi

        done

done < Names.txt

--------END---------------

Sorry for the novice approach.

I have a file with Server and Domain names in it as below.

Names.txt :

ABCDomain ContractABCServer_1
ABCDomain ABC_server1
LinkDomain CoreLinkServer_1
TADDomain TADServer_1

(I'm getting above file after performing sort and unique operations to some other file.)---just additional info

I need to extract values from above file and pass it to a xyz command (the command is used to restart servers) as a parameter in below format.

O/P:

"ABCDomain(server:ContractABCServer_1,server:ABC_server1)","LinkDomain(server:CoreLinkServer_1)","TADDomain(TADServer_1)"

I m using below stated logic, but it doesn't give me the desired output as the DomainName has to come just once for each set. Also I m having trouble in keeping the same line.

-----------START------

    DOMAIN=''

IFS=' '
while read line
do
        DOMAIN=$(echo "$line" | awk -F " " '{print $1}')

        for word in $line
        do
                if [[ "$word" == "$DOMAIN" ]]; then
                        Server=$(echo "$line" | awk -F " " '{print $2}' )
                        echo -n "(server:$ServerName"
                fi

        done

done < Names.txt

--------END---------------

Sorry for the novice approach.

I have a file with Server and Domain names in it as below.

Names.txt :

ABCDomain ContractABCServer_1
ABCDomain ABC_server1
LinkDomain CoreLinkServer_1
TADDomain TADServer_1

(I'm getting above file after performing sort and unique operations to some other file.)---just additional info

I need to extract values from above file and pass it to a xyz command (the command is used to restart servers) as a parameter in below format.

O/P:

"ABCDomain(server:ContractABCServer_1,server:ABC_server1)","LinkDomain(server:CoreLinkServer_1)","TADDomain(TADServer_1)"

I m using below stated logic, but it doesn't give me the desired output as the DomainName has to come just once for each set. Also I m having trouble in keeping the same line.

-----------START------

    DOMAIN=''

IFS=' '
while read line
do
        DOMAIN=$(echo "$line" | awk -F " " '{print $1}')

        for word in $line
        do
                if [[ "$word" == "$DOMAIN" ]]; then
                        Server=$(echo "$line" | awk -F " " '{print $2}' )
                        echo -n "(server:$ServerName"
                fi

        done

done < Names.txt
3 In the O/P : I need "server" string for every servers not just once at the beginning. Something like this.
source | link

I have a file with Server and Domain names in it as below.

Names.txt :

ABCDomain ContractABCServer_1
ABCDomain ABC_server1
LinkDomain CoreLinkServer_1
TADDomain TADServer_1

(I'm getting above file after performing sort and unique operations to some other file.)---just additional info

I need to extract values from above file and pass it to a xyz command (the command is used to restart servers) as a parameter in below format.

O/P:

"ABCDomain(server:ContractABCServer_1,server:ABC_server1)","LinkDomain(server:CoreLinkServer_1)","TADDomain(TADServer_1)"

I m using below stated logic, but it doesn't give me the desired output as the DomainName has to come just once for each set. Also I m having trouble in keeping the same line.

-----------START------

    DOMAIN=''

IFS=' '
while read line
do
        DOMAIN=$(echo "$line" | awk -F " " '{print $1}')

        for word in $line
        do
                if [[ "$word" == "$DOMAIN" ]]; then
                        Server=$(echo "$line" | awk -F " " '{print $2}' )
                        echo -n "(server:$ServerName"
                fi

        done

done < Names.txt

--------END---------------

Sorry for the novice approach.

I have a file with Server and Domain names in it as below.

Names.txt :

ABCDomain ContractABCServer_1
ABCDomain ABC_server1
LinkDomain CoreLinkServer_1
TADDomain TADServer_1

(I'm getting above file after performing sort and unique operations to some other file.)---just additional info

I need to extract values from above file and pass it to a xyz command (the command is used to restart servers) as a parameter in below format.

O/P:

"ABCDomain(server:ContractABCServer_1,ABC_server1)","LinkDomain(server:CoreLinkServer_1)","TADDomain(TADServer_1)"

I m using below stated logic, but it doesn't give me the desired output as the DomainName has to come just once for each set. Also I m having trouble in keeping the same line.

-----------START------

    DOMAIN=''

IFS=' '
while read line
do
        DOMAIN=$(echo "$line" | awk -F " " '{print $1}')

        for word in $line
        do
                if [[ "$word" == "$DOMAIN" ]]; then
                        Server=$(echo "$line" | awk -F " " '{print $2}' )
                        echo -n "(server:$ServerName"
                fi

        done

done < Names.txt

--------END---------------

Sorry for the novice approach.

I have a file with Server and Domain names in it as below.

Names.txt :

ABCDomain ContractABCServer_1
ABCDomain ABC_server1
LinkDomain CoreLinkServer_1
TADDomain TADServer_1

(I'm getting above file after performing sort and unique operations to some other file.)---just additional info

I need to extract values from above file and pass it to a xyz command (the command is used to restart servers) as a parameter in below format.

O/P:

"ABCDomain(server:ContractABCServer_1,server:ABC_server1)","LinkDomain(server:CoreLinkServer_1)","TADDomain(TADServer_1)"

I m using below stated logic, but it doesn't give me the desired output as the DomainName has to come just once for each set. Also I m having trouble in keeping the same line.

-----------START------

    DOMAIN=''

IFS=' '
while read line
do
        DOMAIN=$(echo "$line" | awk -F " " '{print $1}')

        for word in $line
        do
                if [[ "$word" == "$DOMAIN" ]]; then
                        Server=$(echo "$line" | awk -F " " '{print $2}' )
                        echo -n "(server:$ServerName"
                fi

        done

done < Names.txt

--------END---------------

Sorry for the novice approach.

2 Markup
source | link

I have a file with Server and Domain names in it as below.

Names.txt :

ABCDomain ContractABCServer_1
ABCDomain ABC_server1
LinkDomain CoreLinkServer_1
TADDomain TADServer_1

(I'm getting above file after performing sort and unique operations to some other file.)---just additional info

I need to extract values from above file and pass it to a xyz command (the command is used to restart servers) as a parameter in below format.

O/P:

"ABCDomain(server:ContractABCServer_1,ABC_server1)","LinkDomain(server:CoreLinkServer_1)","TADDomain(TADServer_1)"

I m using below stated logic, but it doesn't give me the desired output as the DomainName has to come just once for each set. Also I m having trouble in keeping the same line.

-----------START------

    DOMAIN=''

IFS=' ' while read line do DOMAIN=$(echo "$line" | awk -F " " '{print $1}')


IFS=' '
while read line
do
        DOMAIN=$(echo "$line" | awk -F " " '{print $1}')

        for word in $line
        do
                if [[ "$word" == "$DOMAIN" ]]; then
                        Server=$(echo "$line" | awk -F " " '{print $2}' )
                        echo -n "(server:$ServerName"
                fi

        done 

done < Names.txt

done < Names.txt

--------END---------------

Sorry for the novice approach.

I have a file with Server and Domain names in it as below.

Names.txt :

ABCDomain ContractABCServer_1
ABCDomain ABC_server1
LinkDomain CoreLinkServer_1
TADDomain TADServer_1

(I'm getting above file after performing sort and unique operations to some other file.)---just additional info

I need to extract values from above file and pass it to a xyz command (the command is used to restart servers) as a parameter in below format.

O/P:

"ABCDomain(server:ContractABCServer_1,ABC_server1)","LinkDomain(server:CoreLinkServer_1)","TADDomain(TADServer_1)"

I m using below stated logic, but it doesn't give me the desired output as the DomainName has to come just once for each set. Also I m having trouble in keeping the same line.

-----------START------

DOMAIN=''

IFS=' ' while read line do DOMAIN=$(echo "$line" | awk -F " " '{print $1}')

    for word in $line
    do
            if [[ "$word" == "$DOMAIN" ]]; then
                    Server=$(echo "$line" | awk -F " " '{print $2}' )
                    echo -n "(server:$ServerName"
            fi

    done

done < Names.txt

--------END---------------

Sorry for the novice approach.

I have a file with Server and Domain names in it as below.

Names.txt :

ABCDomain ContractABCServer_1
ABCDomain ABC_server1
LinkDomain CoreLinkServer_1
TADDomain TADServer_1

(I'm getting above file after performing sort and unique operations to some other file.)---just additional info

I need to extract values from above file and pass it to a xyz command (the command is used to restart servers) as a parameter in below format.

O/P:

"ABCDomain(server:ContractABCServer_1,ABC_server1)","LinkDomain(server:CoreLinkServer_1)","TADDomain(TADServer_1)"

I m using below stated logic, but it doesn't give me the desired output as the DomainName has to come just once for each set. Also I m having trouble in keeping the same line.

-----------START------

    DOMAIN=''

IFS=' '
while read line
do
        DOMAIN=$(echo "$line" | awk -F " " '{print $1}')

        for word in $line
        do
                if [[ "$word" == "$DOMAIN" ]]; then
                        Server=$(echo "$line" | awk -F " " '{print $2}' )
                        echo -n "(server:$ServerName"
                fi

        done 

done < Names.txt

--------END---------------

Sorry for the novice approach.

1
source | link