en vi:
vi +X filename
en Emacs:
emacs +X filename
en la cáscara:
nl -ba -nln filename| grep '^X '
puede utilizar grep contexto cgrep en lugar de grep
para ver algunas líneas por encima y por debajo de la línea de juego ..
EJEMPLOS:
de impresión sólo que una línea:
$ nl -ba -nln active_record.rb | grep '^111 '
111 module ConnectionAdapters
con el contexto:
$ nl -ba -nln active_record.rb | grep -C 2 '^111 '
109 end
110
111 module ConnectionAdapters
112 extend ActiveSupport::Autoload
113
para el control de contexto en grep
cheque man grep
:
Context Line Control
-A NUM, --after-context=NUM
Print NUM lines of trailing context after matching lines. Places a line containing a group separator (--) between contiguous groups of matches. With the -o or --only-matching option, this has no effect and a warning is given.
-B NUM, --before-context=NUM
Print NUM lines of leading context before matching lines. Places a line containing a group separator (--) between contiguous groups of matches. With the -o or --only-matching option, this has no effect and a warning is given.
-C NUM, -NUM, --context=NUM
Print NUM lines of output context. Places a line containing a group separator (--) between contiguous groups of matches. With the -o or --only-matching option, this has no effect and a warning is given.
Esencialmente equivalente al 'sed' one:' echo Xp | ed -s archivo' –
'awk 'NR == X' archivo' –