in reply to extract (a range of) numbered lines from a file
sed -e '10,15p;4p;s/.*//' file | awk '!/^$/{print $0}' somefile
somefile shouldn't be there, right?
Removing lines can be done with d in sed, so you can shorten it to
sed -e '10,15p;4p;d' | awk ...
but there's also the -n switch for sed which says "don't print", so we can get
sed -ne '10,15p;5p' | awk ...
and we can remove emtpy lines in sed easily with /^$/d which removes the need to call awk:
sed -ne '/^$/d;10,15p;4p' file
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: extract (a range of) numbered lines from a file
by shmem (Chancellor) on Sep 21, 2016 at 17:45 UTC | |
by choroba (Cardinal) on Sep 21, 2016 at 18:31 UTC | |
by shmem (Chancellor) on Sep 21, 2016 at 18:53 UTC | |
by choroba (Cardinal) on Sep 21, 2016 at 19:32 UTC | |
by shmem (Chancellor) on Sep 21, 2016 at 19:40 UTC |