|
发表于 2012-1-16 19:59:18
|
显示全部楼层
cat test.log
aa bb cc -------- 1234
ad ad afad ----- adf
adkfd da -------- 323
perl -nle 'print $1."#".$2 if /([a-z\s]+)[-]+([\sa-zA-Z0-9]+)/' test.log
aa bb cc # 1234
ad ad afad # adf
adkfd da # 323
更高效的做法
perl -nle 'print if s/[-]+//g' test.log
aa bb cc 1234
ad ad afad adf
adkfd da 323 |
|