I am trying to extract the mount points find . -type f -exec file '{}' \;
and ad0
in following example in bash.
ad4
I am trying to extract the mount points "ad*" into an array which would be further used for other things. This is part of a shell script which would use this array.
Thanks for your help with multiple solutions.
答案 0 :(得分:2)
You can simply use const char* good[5] = {
"good", "great", "amazing", "amazing!", "fantastic"
};
const char* bad[5] = {
"bad", "bad pal", "bad eugene", "not good", "not good pal"
};
string input01 = "";
int main() {
cout << "Hello" << endl;
system("PAUSE");
system("CLS");
cout << "How are you doing today?" << endl;
cin >> input01;
transform(input01.begin(), input01.end(), input01.begin(), ::tolower);
if (input01 == good[0 > 5] || good[0 < 5]){
system("CLS");
cout << "good" << endl;
system("pause");
}
else if (input01 == bad[0 > 5] || bad[0 < 5]){
system("CLS");
cout << "bad" << endl;
system("pause");
}
}
and character classes to obtain the mount points:
grep -o
Output:
grep -o ad[0-9]* file
If you want the values in your array:
$ grep -o ad[0-9]* dat/atacntl.txt
ad0
ad4
答案 1 :(得分:1)
database_authenticable
答案 2 :(得分:1)
这是$sql = "SELECT
MONTH (transaction_date),
SUM(case when finance_type != 'Deposit' then amount else 0 end) AS total_amount,
SUM(case when finance_type = 'Deposit' then amount else 0 end) AS deposit,
SUM(case when finance_type != 'Deposit' AND amount < 0 then amount else 0 end) AS expenses,
SUM(case when finance_type != 'Deposit' AND amount > 0 then amount else 0 end) AS earning,
SUM(case when finance_type != 'Deposit' AND amount!='' then num_contract else 0 end) AS total_contracts,
transaction_date
FROM
`tbl_finanace`
WHERE
transaction_date LIKE '%2015%'
AND user_id = '15'
GROUP BY
MONTH (transaction_date)
ORDER BY
MONTH (transaction_date)";
方法。
awk或ad
的{{1}}表单行。
Master