-
Notifications
You must be signed in to change notification settings - Fork 0
/
.arg-rc
159 lines (121 loc) · 2.75 KB
/
.arg-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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
export ah="$(dirname "${BASH_SOURCE[0]}")"
alias reverse=reverse-stdin
alias rvi=reverse-stdin
alias rvs=reverse-stdin
alias dr=drop-regex
alias drr=drop-right-regex
alias drn=drop-regex-n
alias drrn=drop-right-regex-n
alias dch=drop-chars
alias dc1="drop-chars 1"
alias dc2="drop-chars 2"
alias dc3="drop-chars 3"
alias dc4="drop-chars 4"
alias dc5="drop-chars 5"
alias dcr=drop-chars-right
alias drc=drop-chars-right
alias dcrn="drop-chars-right-n"
alias dcr1="drop-chars-right-n 1"
alias dcr2="drop-chars-right-n 2"
alias dcr3="drop-chars-right-n 3"
alias dcr4="drop-chars-right-n 4"
alias dcr5="drop-chars-right-n 5"
alias sw=starts-with
alias dsw="starts-with -v"
alias nsw="starts-with -v"
alias swv="starts-with -v"
alias ew=ends-with
alias dew="ends-with -v"
alias new="ends-with -v"
alias ewv="ends-with -v"
alias pp=prepend
alias ap=append
alias bp=bipend
defn tat two-at-a-time-tabs
defn taat two-at-a-time-tabs
defn tts two-at-a-time-spaces
defn taats two-at-a-time-spaces
defn x xargs
defn x0 xargs -0
alias er=escape-regex
alias tff=take-from-first
alias tkff=take-from-first
defn tpf take-past-first
defn dtf take-past-first # aka. drop-to-first
alias dul=drop-until-last
alias tfl=take-from-last
alias tkfl=take-from-last
defn dtl drop-to-last
defn tpl take-past-last
defn tpls take-past-last /
defn dfl drop-from-last
defn tul take-until-last
defn dpl drop-past-last
defn ttl take-to-last
alias dfl.="drop-from-last ."
alias pt="paste -d' ' - -"
alias zs="paste -d' ' - -"
alias pts="paste -d' ' - -"
alias ptn="paste -d'\n' - -"
alias pt3="paste -d' ' - - -"
alias zs3="paste -d' ' - - -"
alias t=tee
alias ta="tee -a"
alias tc=cache
alias ca=count
defn una uname -a
defn unm uname -m
defn cn cat-n
keep_n_chars() {
local n="$1"; shift
while IFS= read -r line; do
echo "${line:0:$n}"
done
}
export -f keep_n_chars
defn knc keep_n_chars
defn kc keep_n_chars
defn kc1 keep_n_chars 1
defn kc2 keep_n_chars 2
defn kc3 keep_n_chars 3
defn kc4 keep_n_chars 4
defn kcs keep_n_chars
defn kr kill-regex
defn kx kill-regex
defn krs kill-regexs
defn kxs kill-regexs
defn kq kill-regex '\"'
defn kqs kill-regex '\"'
defn kcr tr -d $'\r'
defn exists apply-test -e
defn dne apply-test '!' -e
defn tk take
defn tkr take-right
defn tt take-to
defn tu take-until
defn tuf take-until
defn dpf take-to
defn dff take-until
alias cpt=capture
defn dr1 drop-chars-right-n 1
alias trd="tr -d"
defn sdf sed -f
defn sedf sed -f
seds() {
# seds s/find1/replace1/ s/find2/replace2/ ...
args=()
for cmd in "$@"; do
args+=(-e "$cmd")
done
sed "${args[@]}"
}
export -f seds
sedss() {
# sedss find1/replace1 find2/replace2 ...
args=()
for cmd in "$@"; do
args+=("s/$cmd/")
done
seds "${args[@]}"
}
export -f sedss