0
0
mirror of https://github.com/tursodatabase/libsql.git synced 2025-06-09 20:30:39 +00:00
Files
.cargo
.github
bindings
bottomless
bottomless-cli
docker-compose
docs
libsql
libsql-ffi
libsql-hrana
libsql-replication
libsql-server
libsql-shell
libsql-sqlite3
art
autoconf
contrib
crates
doc
ext
mptest
src
test
tool
win
GetFile.cs
GetTclKit.bat
Replace.cs
build-all-msvc.bat
build-shell.sh
cg_anno.tcl
checkSpacing.c
cktclsh.sh
custom.txt
dbhash.c
dbtotxt.c
dbtotxt.md
enlargedb.c
extract-sqlite3h.tcl
extract.c
fast_vacuum.c
fragck.tcl
fuzzershell.c
generate-artifacts.sh
genfkey.README
genfkey.test
getlock.c
index_usage.c
kvtest-speed.sh
lemon.c
lempar.c
libvers.c
loadfts.c
logest.c
max-limits.c
merge-test.tcl
mkautoconfamal.sh
mkccode.tcl
mkctimec.tcl
mkkeywordhash.c
mkmsvcmin.tcl
mkopcodec.tcl
mkopcodeh.tcl
mkopts.tcl
mkpragmatab.tcl
mkshellc.tcl
mksourceid.c
mkspeedsql.tcl
mksqlite3c-noext.tcl
mksqlite3c.tcl
mksqlite3h.tcl
mksqlite3internalh.tcl
mktoolzip.tcl
mkvsix.tcl
offsets.c
omittest-msvc.tcl
omittest.tcl
opcodesum.tcl
pagesig.c
pre-release.sh
replace.tcl
restore_jrnl.tcl
rollback-test.c
run-speed-test.sh
showdb.c
showjournal.c
showlocks.c
showshm.c
showstat4.c
showwal.c
soak1.tcl
spaceanal.tcl
speed-check.sh
speedtest.tcl
speedtest16.c
speedtest2.tcl
speedtest8.c
speedtest8inst1.c
spellsift.tcl
split-sqlite3c.tcl
sqldiff.c
sqlite3_analyzer.c.in
sqltclsh.c.in
sqltclsh.tcl
src-verify.c
srcck1.c
srctree-check.tcl
stack_usage.tcl
stripccomments.c
symbols-mingw.sh
symbols.sh
varint.c
vdbe-compress.tcl
vdbe_profile.tcl
version-info.c
warnings-clang.sh
warnings.sh
vsixtest
.gitignore
Dockerfile-wasm-udf
LIBSQL_VERSION
LICENSE.md
Makefile.in
Makefile.linux-gcc
Makefile.msc
README-SQLite.md
VERSION
aclocal.m4
config.guess
config.sub
configure
configure.ac
install-sh
libsql.pc.in
ltmain.sh
magic.txt
main.mk
manifest
manifest.uuid
spec.template
sqlite.pc.in
sqlite3.1
sqlite3.pc.in
sqlite_cfg.h.in
libsql-sys
tools
vendored
xtask
.dockerignore
.env
.gitignore
.gitmodules
CODE_OF_CONDUCT.md
Cargo.lock
Cargo.toml
Dockerfile
Dockerfile.dev
LICENSE.md
README-libsql.md
README.md
docker-entrypoint.sh
fly.toml
rust-toolchain.toml
libsql/libsql-sqlite3/tool/replace.tcl

24 lines
743 B
Tcl
Raw Normal View History

#!/usr/bin/tcl
#
# Replace string with another string -OR- include
# only lines successfully modified with a regular
# expression.
#
fconfigure stdout -translation binary -encoding binary
fconfigure stderr -translation binary -encoding binary
set mode [string tolower [lindex $argv 0]]
set from [lindex $argv 1]
set to [lindex $argv 2]
if {-1 == [lsearch -exact [list exact regsub include] $mode]} {exit 1}
if {[string length $from]==0} {exit 2}
while {![eof stdin]} {
set line [gets stdin]
if {[eof stdin]} break
switch -exact $mode {
exact {set line [string map [list $from $to] $line]}
regsub {regsub -all -- $from $line $to line}
include {if {[regsub -all -- $from $line $to line]==0} continue}
}
puts stdout $line
}