我有一个shell变量
str= this 'is shell' script 'to learn'
我想用'
替换第一次出现的" '
,用'
替换第二次出现的' "
,依此类推
最终
str= this "'is shell'" script "'to learn'"
答案 0 :(得分:0)
echo $str | perl -pe "s|'(.*?)'|\"'\1'\"|g"
答案 1 :(得分:0)
尝试一下
<div class="table-responsive">
<table id="http_response" class="table table-bordred table-bordred table-striped">
<thead>
<th>Response</th>
</thead>
<tr>
<td>Mac</td>
<td>Parameter Name</td>
<td>Response</td>
</tr>
</table>
</div>
//JS FIle
var tr;
tr = $('<tr/>');
tr.append("<td>" + mac + "</td>");
tr.append("<td>" + result["response"].parameter_name + "</td>");
tr.append("<td>" + result["response"].status + "</td>")
$('#http_response').append(tr);