Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Adam Osuchowski
Kea
Commits
8b82620d
Commit
8b82620d
authored
Jun 10, 2013
by
Mukund Sivaraman
Browse files
[2968] Document the sed command
parent
6f11ce8d
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/bin/dbutil/tests/dbutil_test.sh.in
View file @
8b82620d
...
...
@@ -140,6 +140,21 @@ get_schema() {
db1
=
@abs_builddir@/dbutil_test_schema_
$$
copy_file
$1
$db1
# The purpose of the following sed command is to join multi-line SQL
# statements to form single-line SQL statements.
#
# The sed command is explained as follows:
# ':a' creates a new label "a"
# 'N' appends the next line to the pattern space
# '$!ba' if it's not the last line, branch to "a"
#
# The above makes sed loop over the entire sqlite3 output. At this
# point, the pattern space contain all lines in the sqlite3 output.
#
# 's/,[\ ]*\n/, /g' then substitutes lines trailing with comma
# followed by zero or more spaces and the newline character, with
# just a comma and a single space.
db_schema
=
`
sqlite3
$db1
'.schema'
|
\
sed
-e
':a'
-e
'N'
-e
'$!ba'
-e
's/,[\ ]*\n/, /g'
|
\
sort
|
\
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment