4 ms·
1. tcpclient, yy025 (a program I wrote that generates HTTP), sed, cut, paste, nvi or vim 4.6 if I need to edit, depending on whether I'm using NetBSD or Linux;
by 1vuio0pswjnm7 2y ago
1. tcpclient, yy025 (a program I wrote that generates HTTP), sed, cut, paste, nvi or vim 4.6 if I need to edit, depending on whether I'm using NetBSD or Linux; formatted text is copied and pasted using tmux buffers since I do not use X11
For example
program|sed or grep|tmux loadb /dev/stdin
where program is a script that outputs a custom ASCII table
2. The UNIX software I'm using works with these characters
The idiom I use for inserting the FS character via command line or shell script is
x=$(echo x|tr x '\34')
For example,
echo select \* from t1|sqlite3 -separator $x 0.db > 0.fsv
"To import data with arbitrary delimiters and no quoting, first set ascii mode (".mode ascii"), then set the field and record delimiters using the ".separator" command. This will suppress dequoting. Upon ".import", the data will be split into fields and records according to the delimiters so specified."^1
But I use tr.
tr '\34' , < 0.fsv > 0.csv
If there is a risk that field values might contain the FS character, then I delete or replace that character in the data before I create fields. For example,
sed -i "s/$x//g" data
sed -i "s/$x/FS/g" data
1. https://sqlite.org/cli.html https://sqlite.org/cli.html
- 1vuio0pswjnm7 2y agoNote to self: This originally got an up.