# ok
sed -e
"
:begin;
{
/\*\//!
{
$!
{
N;
b begin
};
};
s/\/\*.*\*\// /;
};
"
2.txt
sed -e ":begin; { /\*\//! { $! { N; b begin }; }; s/\/\*.*\*\// /; };" 2.txt
# xx line delete
sed
'
/\/\*/
{
/\*\//d;
:a;
N;
/\*\//d;
ba
};
s,//.*,,
'
2.txt
sed 不删除最后一行
sed -e ' : begin; /_ASMLANGUAGE/! { $! { N; b begin; }; }; s/.*_ASMLANGUAGE/#define _ASMLANGUAGE/; ' context.s
sed -e
'
: begin;
/_ASMLANGUAGE/!
{
$!
{
N;
b begin;
};
};
s/.*_ASMLANGUAGE/#define _ASMLANGUAGE/;
'
context.s
删除xml注释
sed -e
'
:begin ;
/-->/!
{
$!
{
N;
b begin;
}
};
s/<!--.*-->/ /;
'
acpi.xml
sed -e ' :begin ; /-->/! { $! { N; b begin; } }; s/<!--.*-->/ /; ' acpi.xml