我想使用sed从包含模式myvar = myvar
的文件中删除行。因此,例如,我编辑的汇编文件包含如下行:
wmemcopy = wmemcopy
我尝试了sed命令:
sed '/^\([a-z]*\) = \1$/d'
但是该命令无法找到并删除这些行。是否有用于完成此操作的sed命令?
编辑:
如果我使用sed -i '/^\([a-z]*\) = \1$/d' wtent.s
尝试命令,则不会删除这些行。这是我尝试此命令的文件:
.file 1 "wtent.c"
.section .mdebug.abi32
.previous
.gnu_attribute 4, 1
.text
.align 2
.globl updwtmp
.hidden updwtmp
.set nomips16
.ent updwtmp
.type updwtmp, @function
updwtmp:
.frame $sp,32,$31 # vars= 0, regs= 3/0, args= 16, gp= 0
.mask 0x80030000,-4
.fmask 0x00000000,0
addiu $sp,$sp,-32
move $6,$0
sw $17,24($sp)
sw $31,28($sp)
move $17,$5
sw $16,20($sp)
li $5,9 # 0x9
#APP
# 40 "libc/misc/utmp/wtent.c" 1
.set noreorder
li $2, 4005 # open
syscall
.set reorder
# 0 "" 2
#NO_APP
move $16,$2
beq $7,$0,$L2
sw $2,errno
j $L1
$L2:
bltz $2,$L1
move $4,$2
li $5,1 # 0x1
jal lockf
bne $2,$0,$L1
move $4,$16
move $5,$17
li $6,384 # 0x180
#APP
# 43 "libc/misc/utmp/wtent.c" 1
.set noreorder
li $2, 4004 # write
syscall
.set reorder
# 0 "" 2
#NO_APP
beq $7,$0,$L6
sw $2,errno
$L6:
move $4,$16
move $5,$0
move $6,$0
jal lockf
move $4,$16
#APP
# 45 "libc/misc/utmp/wtent.c" 1
.set noreorder
li $2, 4006 # close
syscall
.set reorder
# 0 "" 2
#NO_APP
$L1:
lw $31,28($sp)
lw $17,24($sp)
lw $16,20($sp)
addiu $sp,$sp,32
j $31
.end updwtmp
.size updwtmp, .-updwtmp
.globl updwtmp
updwtmp = updwtmp
.ident "GCC: (GNU) 4.7.0"