lina (lina.lastn...@gmail.com on 2011-12-19 23:53 +0800): > > sed -n '/^model 1/q;/^model 0/,$p' > > Just realize the sed -n '/model 0/,/model 1/'p can also do that. (so > newbie I was/am). > > just still don't understand above sentence. sed -n '/^model > 1/q;/^model 0/,$p'
The semicolon separates two commands. The first one matches on model 1, and quits sed (stops processing). The second one is a range command, matches from the model 0 line to the end of the file ($), and prints the current line. Arguably, the single range command (/model 0/,/model 1/) is a better solution because it also works in the aggregate case (cat *|sed instead of sed *). Regards, Arno -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20111219192856.4d59a...@neminis.intra.loos.site