ワンライナー.3.M行目からN行目まで表示
PHP
bash
cat a.txt | php -R 'if (3 <= $argi && $argi <= 5) { echo $argn . "\n"; }'
1オリジン
Bash
bash
cat a.txt | awk '3 <= NR && NR <= 5 { print $0 }'
1オリジン
Ruby
bash
cat a.txt | ruby -ne 'print if 3 .. 5'
でも deprecated なのか
txt
-e:1: warning: flip-flop is deprecated
Perl
bash
cat a.txt | perl -ne 'print if 3 .. 5'