Saturday, April 23, 2011
Saturday, March 12, 2011
grep files from results by find
find /var/ftp/mp3 -name "*.mp3" -type f -exec chmod 644 {} \; This command changes the permissions of all files with a name ending in .mp3 in the directory /var/ftp/mp3. The action is carried out by specifying the option -exec chmod 644 {} \; in the command. For every file whose name ends in .mp3, the command chmod 644 {} is executed replacing {} with the name of the file. The semicolon (backslashed to avoid the shell interpreting it as a command separator) indicates the end of the command. Permission 644, usually shown as rw-r--r--, gives the file owner full permission to read and write the file, while other users have read-only access. In some shells, the {} must be quoted. copied from http://en.wikipedia.org/wiki/Find
Saturday, March 5, 2011
Sunday, February 6, 2011
sqlite3 scripts comments notation
--
-- ********************************************************************
-- Creating a trigger for timeEnter
-- Run as follows:
-- $ sqlite3 test.db < trigger1
-- ********************************************************************
CREATE TRIGGER insert_t1_timeEnter AFTER INSERT ON t1
BEGIN
UPDATE t1 SET timeEnter = DATETIME('NOW') WHERE rowid = new.rowid;
END;
-- ********************************************************************
-- ********************************************************************
-- Creating a trigger for timeEnter
-- Run as follows:
-- $ sqlite3 test.db < trigger1
-- ********************************************************************
CREATE TRIGGER insert_t1_timeEnter AFTER INSERT ON t1
BEGIN
UPDATE t1 SET timeEnter = DATETIME('NOW') WHERE rowid = new.rowid;
END;
-- ********************************************************************
Sunday, January 30, 2011
sqlite dump
copied from http://stackoverflow.com/questions/75675/how-do-i-dump-the-data-of-some-sqlite3-tables
You don't say what you wish to do with the dumped file.
I would use the following to get a CSV file, which I can import into almost everything
.mode csv
.header on
.out file.dmp
select * from emp;
If you want to reinsert into a different SQLite database then:
.mode insert
.out file.sql
select * from em
compile sqlite3 to be a shared library
gcc -c -fPIC sqlite3.c
# gcc -shared -o libsqlite3.so -fPIC sqlite3.o
gcc -shared -o libsqlite3.so -fPIC sqlite3.o -ldl -lpthread
Subscribe to:
Posts (Atom)