3
두 줄 사이에 줄을 인쇄하는 한 줄짜리 줄이 있지만 * .pm과 일치하는 줄이있는 경우 다른 줄을 추가하고 싶습니다. .pm :텍스트 블록의 선택적 인쇄에만 일치하는 줄이 있습니다
perl -e 'while(<>){s/^/$ARGV:/; print if m#VLOG {Updated files}# .. m#VLOG {Priority}#;}'
샘플 데이터 : 모든 지원이 매우 감사
VLOG {Updated files}
files/skel/usr/local/cp/Modules/vsap/config.pm
files/skel/usr/local/cp/Modules/vsap/files/list.pm
files/skel/usr/local/cp/lib/i386-linux-thread-multi/perllocal.pod
files/skel/usr/local/cp/templates/default/cp/files/dirdialog.xsl
VLOG {Removed files}
VLOG {Priority}
. 감사.
perl -e 'while(<>){s/^/$ARGV:/; push @save,$_ if m#VLOG {Updated files}# .. m#VLOG {Priority}#;} print @save;'
지금 당신이 '가 .pm'로 끝나는 라인을 찾아 원하는 :
제공된 코드는 작동하지 않습니다. ( – Francis