in vi:
vi +X filename
in EMACS:
emacs +X filename
in the shell:
nl -ba -nln filename| grep '^X '
you can use context grep cgrep instead of grep
to see some lines above and below the matching line..
EXAMPLES:
print just that one line:
$ nl -ba -nln active_record.rb | grep '^111 '
111 module ConnectionAdapters
with context:
$ nl -ba -nln active_record.rb | grep -C 2 '^111 '
109 end
110
111 module ConnectionAdapters
112 extend ActiveSupport::Autoload
113
for context control in grep
check 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.