how to execute for loop with sed in terminal
        Posted  
        
            by 
                vipin8169
            
        on Ask Ubuntu
        
        See other posts from Ask Ubuntu
        
            or by vipin8169
        
        
        
        Published on 2012-11-06T04:40:14Z
        Indexed on 
            2012/11/06
            5:19 UTC
        
        
        Read the original article
        Hit count: 334
        
I want to execute the for loop with sed command, and is getting an error for the same
for i in <comma-separated server name list>;do "command";echo $i;done
where command=sed '/^$/d' /home/nextag/instance.properties|grep -vc '#'
I'm getting the following error :- -bash: sed "/^$/d" /home/nextag/instance.properties|grep -vc#: No such file or directory
lu1
What is the correct way to execute this command to get the perfect output
I tried this as well>> for i in lu1;do 'sed \'/^$/d\' /home/nextag/instance.properties|grep -vc \'#\'';echo $i;done
Also, can some explain the part '/^$/d'in sed '/^$/d' /home/nextag/instance.properties|grep -vc '#'
© Ask Ubuntu or respective owner