c:\> perl -n -e "print if /^abcde.+PARTNAME$/" c:\somefile.txt>k:\1\somefile.txt #### c:\> perl -n -e "print if /^abcde/ && /PARTNAME$/" c:\somefile.txt>k:\1\somefile.txt #### substr() c:\> perl -n -e "print if substr($_,0,5) eq q(abcde) && substr($_,-9) eq qq(PARTNAME\n)" c:\somefile.txt>k:\1\somefile.txt
## c:\> perl -n -e "print if /^abcde/ && /PARTNAME$/" c:\somefile.txt>k:\1\somefile.txt ##
## substr() c:\> perl -n -e "print if substr($_,0,5) eq q(abcde) && substr($_,-9) eq qq(PARTNAME\n)" c:\somefile.txt>k:\1\somefile.txt