-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathShellToolbelt.html.html.html
55 lines (55 loc) · 1.79 KB
/
ShellToolbelt.html.html.html
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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, user-scalable=yes"
/>
<title>ShellToolbelt</title>
<style type="text/css">
code {
white-space: pre-wrap;
}
span.smallcaps {
font-variant: small-caps;
}
span.underline {
text-decoration: underline;
}
div.column {
display: inline-block;
vertical-align: top;
width: 50%;
}
</style>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6"
crossorigin="anonymous"
/>
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"
integrity="sha384-j0CNLUeiqtyaRmlzUHCPZ+Gy5fQu0dQ6eZ/xAww941Ai1SxSY+0EQqNXNE6DZiVc"
crossorigin="anonymous"
></script>
</head>
<body>
<p>Transform every second line</p>
<p>using awk</p>
<pre><code>awk 'ORS=NR%2?" ":"\n"'</code></pre>
<p>And the same in <code>sed</code></p>
<pre><code>sed ':a;N;$!ba;s/\nGroup/ Group/g'</code></pre>
<p>
If the line number is evenly divisible by 2, end with a new line,
otherwise, end with a space.
</p>
<pre><code>grep -oP "<asp:TextBox[^>]*ID=\"\K(\w+)|(?<=\G)[^>]*MaxLength=\"\K(\d+)" new.txt
| awk 'ORS=NR%2?" ":"\n"'</code></pre>
<p>Output:</p>
<pre><code>txtComments 1000
txtDescription 240</code></pre>
</body>
</html>