Comments (4)
  • Add a Comment
  • Edit
  • More Actions v
  • Quarantine this Entry

1 raduu commented Permalink

Hi, <div>&nbsp;</div> You may try: <br /> cat original_file | perl -ne 'print $_ unless ($_ eq $prev &amp;&amp; $_ =~ "\cL" ) ; $prev = $_' | lp -d queue_name <div>&nbsp;</div> For example: <br /> # cat -v pr <br /> ^L <br /> ^L <br /> test <br /> a <br /> a <br /> ^L <br /> b <br /> ^L <br /> ^L <br /> c <div>&nbsp;</div> # cat pr| perl -ne 'print $_ unless ($_ eq $prev &amp;&amp; $_ =~ "\cL" ) ; $prev = $_' &gt; pr.out <br /> # cat -v pr.out <br /> ^L <br /> test <br /> a <br /> a <br /> ^L <br /> b <br /> ^L <br /> c <div>&nbsp;</div>

2 esv commented Permalink

try this too: <div>&nbsp;</div> sed -e 's/^L\([^^L]\)/\1/;s/^L^L/^L/'

3 Glukacs1 commented Permalink

Sorry, I had not much time to work on this, so I grabbed the first idea came to my head: <div>&nbsp;</div> Example file: <br /> # cat /tmp/1|od -cb <br /> 0000000 \f \n 1 \n 2 \n \f \n \f \n 3 \n 4 \n \f \n <br /> 014 012 061 012 062 012 014 012 014 012 063 012 064 012 014 012 <br /> 0000020 5 \n <br /> 065 012 <div>&nbsp;</div> <div>&nbsp;</div> # cat -vte /tmp/1 <br /> ^L$ <br /> 1$ <br /> 2$ <br /> ^L$ <br /> ^L$ <br /> 3$ <br /> 4$ <br /> ^L$ <br /> 5$ <div>&nbsp;</div> Created script: <br /> # cat /tmp/1.sh <br /> #!/usr/bin/ksh <br /> export PREV_LINE='NULL' <br /> cat $@ |while read LINE;do <br /> OD_OUT="$(echo "${LINE}" |od -b |head -1)" <br /> # 014 == ^L ; 013 == \n <br /> if [ "${OD_OUT}" == "0000000 014 012" ] <br /> then <br /> if [ "${OD_OUT}" != "${PREV_LINE}" ] <br /> then <br /> echo "${LINE}" <br /> fi <br /> else <br /> echo "${LINE}" <br /> fi <br /> PREV_LINE="$(echo "${LINE}" |od -b |head -1)" <br /> done <div>&nbsp;</div> After execution: <br /> # cat /tmp/1 |sed "1s/^L//g"|/tmp/1.sh |cat -tve <br /> $ <br /> 1$ <br /> 2$ <br /> ^L$ <br /> 3$ <br /> 4$ <br /> ^L$ <br /> 5$ <div>&nbsp;</div> Is this what are you looking after?

4 AnthonyEnglish commented Permalink

Thanks to those who offered solutions for this form feed problem. I went with the first suggestion using the Perl one-liner, but all three of the comments were great ideas. Problem solved. Thanks again.