Re: Help with sed

2010-04-16 Thread Radim
Radim wrote: > > What I try to do: > 1) To delete the codecs function of the output. > 2) To get the "if mandriva" block > 3) from that block to get lines of urpmi > > Anybody help? > Or better this: content=$(cat $script | sed '/function codecs/,/

Help with sed

2010-04-16 Thread Radim
Hello, I have such script: (ONLY THIS THREE LINES ARE THE COMMANDS ) content=$(cat $script | sed '/function codecs/,/fi;/d'); content=$(echo $content | sed -n '/mandriva/,/fi;}/p'); content=$(echo $content | sed '/^\s*urpmi[:space:]--auto/p'); But it doesn't work as I would expected. This is

Re: Help with sed

2010-04-17 Thread Radim
The script is already solved on other forum. awk 'BEGIN{RS="\n}";FS="if"} !/function codecs/{ for(i=1;i<=NF;i++){ if($i~/mandriva/){ m=split($i,u,"\n") for(j=2;j<=m;j++) if(u[j]~/urpmi/){print "-->"u[j]} } } }' file -- View this message in context: http://old.n