0
のいずれかの側には、私はいくつかの文字列の後と前に持っているものを知りたいコメント# Check if exists the name columns
を持っている部分では、次のPerlスクリプト文字列内の単語与えられた単語
$filters = "SELECT lead_id, status, user, title, first_name, last_name, city, phone_number FROM vicidial_list , vicidial_lists WHERE vicidial_list.list_id = vicidial_lists.list_id";
$stmtA = "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'asterisk' AND TABLE_NAME = 'vicidial_list'";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ", $dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$counter = 0;
$columns =();
while (my @row = $sthA->fetchrow_array) {
# GET the name columns by pos
$column = "@row[0] \n";
# Check if exists the name columns
if (index($filters, @row[$counter]) > -1) {
$find = @row[$counter];
$replace = "vicidial_list." . @row[$counter];
# Replace the name column
$filters =~ s/$find/$replace/g;
}
}
print $filters . "\n\n";
#Close connection
$sthA->finish();
を持っていて下さい。私はNAME
を選択した場合、それはそれはMY
が先行し、IS
が続いていることを返す必要がありますMY NAME IS CRISTOPHER
で例えば
、。
これはどのようにbashに関する質問ですか? –
(BTW - あなたが聞いていることを伝えるのはちょっと難しいですが、できるだけ単純化した[mcve]を作ることができれば、入力、既存の出力、望ましい出力無関係/無関係な要素を含まないコード(例えば、* about * SQLでない場合は、SQLをコードの要素にしないことが理想的です)。 –
スクリプトはPerlにありますが、Bashでも使えます。 –