-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtext.sh
More file actions
41 lines (37 loc) · 686 Bytes
/
text.sh
File metadata and controls
41 lines (37 loc) · 686 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#
# bashfoo.text
#
# text processing helper functions
#
bashfoo.tac.tac()
{
tac "$@"
}
bashfoo.tac.tail_rev()
{
tail -r "$@"
}
#
# TBD, make shalll create feature set file which
# would ultimately tell which tac version shall be used
#
case "$OSTYPE" in
*linux*|*msys*|*cygwin*)
bashfoo.tac() {
bashfoo.tac.tac "$@"
}
;;
*darwin*|*)
bashfoo.tac() {
bashfoo.tac.tail_rev "$@"
}
;;
esac
bashfoo.prefix()
# bashfoo.prefix <PREFIX>
# cat that prefixes all lines with <PREFIX>
{
local prefix="$1"
shift
awk -v "prefix=$prefix" '// {printf("%s%s\n",prefix,$0);}' "$@"
}