-
Notifications
You must be signed in to change notification settings - Fork 0
/
.cols-rc
75 lines (59 loc) · 1.14 KB
/
.cols-rc
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
alias ct="column -t"
alias ctt="column -t -s$'\t'"
alias ct,="column -t -s,"
alias colt="col -i \"$t\""
defn spc tr , '\\n'
defn spn tr : '\\n'
defn sps tr "'" "'" '\\n'
defn spt tr '\\t' '\\n'
alias s:="splt :"
alias sp:="splt :"
alias s,="splt ,"
alias sp,="splt ,"
alias pl="splt /"
alias tk,="splt , | trim | kbl"
alias spls="splt ' '"
alias cl=col
alias c,="col -i,"
alias f,="first -i,"
alias s,="second -i,"
alias dfc="col 1:"
defn 1c first
defn 2c second
defn 3c col 2
defn 4c col 3
defn c0 col 0
defn c1 col 1
defn c2 col 2
defn c3 col 3
defn c4 col 4
defn cl0 col 0
defn cl1 col 1
defn cl2 col 2
defn cl3 col 3
defn cl4 col 4
col_sum() {
cat | col "$@" | sum
}
export -f col_sum
defn csm col_sum
col_sum_h() {
cat | col "$@" | sum | to-human-readable
}
export -f col_sum_h
defn csh col_sum_h
alias csp="cut -d' ' -f"
alias cts="cut -d' ' -f"
alias cus="cut -d' ' -f"
defn csl cut -d/ -f
collapse_whitespace() {
tr -s ' \t' ' ' "$@"
}
export -f collapse_whitespace
defn cw collapse_whitespace
defn cws collapse_whitespace
cut_whitespace() {
tr -s ' \t' ' ' | cut -d' ' -f "$@"
}
export -f cut_whitespace
defn cwf cut_whitespace