perl -ne'print,last,if$.==4' 12345678901234567890123 23 #### perl -nlE'say,last,if$.==4' 1234567890123456789012 22