这是我的示例文本文件:
asdas //<<<TAG this should be removed //TAG>>> this should be there //<<<TAG T > asd asd //TAG>>>
我希望o/p为:
asdas this should be there
基本上我试图找到"// << >>"之间的行(包括这些行)并删除它们.
我尝试使用sed
sed -n'1h; 1!H; $ {; g; s /// <<]*TAG >>> // g; p;}'<test.txt
但有些人如何没有产生正确的输出.正则表达式中包含">"符号的第二个标记失败.不知道我哪里出错了?
知道怎么做吗?
我有一个关联数组
Array(
[289] => Array(
'name'=> 'One'
),
[292] => Array(
'name'=> 'One'
),
[290] => Array(
'name'=> 'One'
)
)
Run Code Online (Sandbox Code Playgroud)
我在这个数组上使用json_encode之后.键被排序,虽然我把它作为JSON对象.
有办法防止这种行为吗?