22 January 2011

LINUX - Loading data into database table

Example: To load username from /etc/passwd into a database table.

awk -F: '{print $1}' /etc/passwd > passwd_txt

cat passwd_txt | while read username; do echo "insert into {TABLE} (USERNAME,GROUPNAME,PRIORITY) values (""'$username'"", 'acct', 0);" >> users.sql; done;

No comments:

APACHE - failed to start

[On] Red Hat Enterprise Linux Server release 7.4 (Maipo) Apache was not running and attempt to start the httpd service failed. The natural t...