I am trying to collect lines from a file with the specific word host: for example the word host, I need to get output of all names of hosts. This is my file:
host= mx,rt,fd,rt,wed,asd, \ fm, jklf,dfd,dfd host = jd,er,ew,yu,tg,ed,ik,cs,\ fd, gr, jy host = mz,fg,jh I am using :
$grep -i host filename | awk '{print $2}'
only works for the first line , it does not output any name after \
so the output is;
mx,rt,fd,rt,wed,asd, \ jd,er,ew,yu,tg,ed,ik,cs,\ mz,fg,jh as you see I am not getting rest of the line after \
I don't want to get rid of \ I would like to keep it, I can move it and connect all names, so it will be seen as one_line , but I don't want to do that.
Any idea , it is appreciated, it could be easy , but I can make it work, even when I use tr.