sed to check two condition need solution

Hi,

I am having a file in below format

server-1 Win2008:server-1-1700,1774,290104720,290104987:server-1
server-2 AIX:server-2-:server-2 server-2

I want the output like this

Win2008:server-1-1700,1774,290104720,290104987:standalon-server
AIX:server-2-:VIO-Sever

I used the cat script but i am not able to check to conduction
server-1 ---> Replace to standalon-server
server-2 server-2---> VIO server

cat all.txt |grep server-2|sed -e "s/server-2 //"| sed -e "s/server-2//"|sed -e "s/server-2/standalon-server/" "s/server-2 server-2/VIO/"
awk 'NR==FNR { A[$1]=$2; next } { print $2":"A[$1] }' listfile inputfile

With listfile like

server-1 standalon-server
server-2 VIO-server

But i also need the all other colume also

Win2008:server-1-1700,1774,290104720,290104987:standalon-server
AIX:server-2-:VIO-Sever

Hi,
check this solution :

listfile content:

server-1:standalon-server
server-2 server-2:VIO-server
awk -F: 'NR==FNR { T[$1]=$2; next } {OFS=":"; sub(/^server-. /,""); sub($NF,T[$NF],$NF); print}' listfile your-input-file-name

Hope this helps you. I have kept it simple:

awk '{print $2}' input_file | awk -F ":" '{if($1=="Win2008") $3=standalon-server;else $3=VIO-server; print $0;}

or

awk '{print $2}' input_file | awk -F ":" 'NR==1{$3=standalon-server;} NR==2{ $3=VIO-server;} {print $0};}

Did you try Corona688's suggestion?

I tried but iam getting error

$ awk 'NR==FNR { A[$1]=$2; next } { print $2":"A[$1] }' listfile all.csv
awk: fatal: cannot open file `listfile' for reading (No such file or directory)

So I make this report simple by doing manual work from excel filter.

The error message says that a file named "listfile" does not exist. So you would need to create that first, like Cororona suggests in his post. Just reread his post and follow his instructions...