echo "" mysql -h x.x.x.x -u user -ppassw dbname -e 'select id,contacts from cms_users where contacts is not NULL;' | grep http://\\S\\+ -o |sed 's/\\n[0-9]//'| sed 's/\\n//'| sed 's/:$//' | sed 's/\/$//' | sed 's/.*diary.ru.*/diary user acc/' |sort -u|sed 's/$/\n /' echo ""