projects
/
grml-etc-core.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
zshrc: Move ic_get to skel/.zshrc
[grml-etc-core.git]
/
usr_share_grml
/
zsh
/
functions
/
linenr
1
# Print a specific line of file(s).
2
emulate -L zsh
3
4
if [ $# -lt 2 ] ; then
5
print "Usage: linenr <number>[,<number>] <file>" ; return 1
6
elif [ $# -eq 2 ] ; then
7
local number=$1
8
local file=$2
9
command ed -s $file <<< "${number}n"
10
else
11
local number=$1
12
shift
13
for file in "$@" ; do
14
if [ ! -d $file ] ; then
15
echo "${file}:"
16
command ed -s $file <<< "${number}n" 2> /dev/null
17
else
18
continue
19
fi
20
done | less
21
fi