On Sat, 9 Aug 2014 00:46:40 +0000, Pew, Curtis G wrote: >On Aug 8, 2014, at 3:35 PM, Paul Gilmartin ><[email protected]> wrote: > >> "tail +2" (not +1!? "Fencepost error".) strips off the first line. Is >> there a utility >> to strip the last line? There seems to be no corresponding option for >> "head". > >"head -1" works for me. z/OS: > ># printf "foo"|uuencode -m newfile|tail +2|head -1 >hpaW > >Mac OS X: >$ printf "foo"|uuencode -m newfile|tail +2|head -1 >Zm9v >
That works if uuencode generates only 3 lines. For other input that might generate more than 3 lines, your command drops everything except the 2nd line. This would work for any size input: printf "%s" "foo" | uuencode -m newfile | egrep -v "^begin-|^====" hpaW because the base64 data would never contain a hyphen or "====". $ cal | uuencode -m newfile begin-base64 000 newfile QEBAQMGkh6Sio0Dy8PH0FeKkQNSWQOOkQOaFQOOIQMaZQOKBFUBAQEBAQEBA QEBAQEBAQEDxQEDyFUDzQED0QED1QED2QED3QED4QED5FfHwQPHxQPHyQPHz QPH0QPH1QPH2FfH3QPH4QPH5QPLwQPLxQPLyQPLzFfL0QPL1QPL2QPL3QPL4 QPL5QPPwFfPxQBU= ==== $ cal | uuencode -m newfile | egrep -v "^begin-|^====" QEBAQMGkh6Sio0Dy8PH0FeKkQNSWQOOkQOaFQOOIQMaZQOKBFUBAQEBAQEBA QEBAQEBAQEDxQEDyFUDzQED0QED1QED2QED3QED4QED5FfHwQPHxQPHyQPHz QPH0QPH1QPH2FfH3QPH4QPH5QPLwQPLxQPLyQPLzFfL0QPL1QPL2QPL3QPL4 QPL5QPPwFfPxQBU= $ cal | uuencode -m newfile | sed '1d;$d' QEBAQMGkh6Sio0Dy8PH0FeKkQNSWQOOkQOaFQOOIQMaZQOKBFUBAQEBAQEBA QEBAQEBAQEDxQEDyFUDzQED0QED1QED2QED3QED4QED5FfHwQPHxQPHyQPHz QPH0QPH1QPH2FfH3QPH4QPH5QPLwQPLxQPLyQPLzFfL0QPL1QPL2QPL3QPL4 QPL5QPPwFfPxQBU= $ cal | uuencode -m newfile | tail +2 | head -1 QEBAQMGkh6Sio0Dy8PH0FeKkQNSWQOOkQOaFQOOIQMaZQOKBFUBAQEBAQEBA Bill ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
