From: Richard Mackerras (richard.mackerras@avonandsomerset.police.uk)
Date: Wed Apr 17 2002 - 13:03:00 EDT
Hi,
Summary:
Why can I paste more than 1000 lines of text into vi running in an
xterm but if I try to paste 100 lines into awk, sort, wc, dd, ...
many lines are just lost?
Can I write a perl script which will be as reliable as vi?
Thanks,
Richard
Long:
I am writing a shell script with the sole purpose for it to be able to
accept pasted input.
highlight lots of text in one window
move to the xterm
click middle mouse button
^d or "." to indicate end of input
If I have highlighted 100 lines of text (man page, many lines are 70 char
long) the first 32 lines appear on the screen but only the last 18 lines are
actually transmitted. Lines 33 to 84 vanish in the ether.
If I have highlighted 20 lines all appear on the screen and all are
transmitted.
If I remove the lines in my shell script which collect the data and replace
them with a call to "vi" I can paste the full xterm buffer of the source
window into the destination xterm (over 1000 lines).
If I run sort in the destination window and paste 1000 lines I see lines 1
to 35 on the screen but when I enter the end_of_file (^d) sort outputs only
lines 147 to 1000. With "wc" or "dd" the behaviour is the same.
Dtterm was a little different but essentially just as bad.
I am using Exceed on Window NT4.
The script:
===========
#!/usr/bin/ksh
...
do_em(){
...
(echo "$EMAIL_HEADERS"
awk '
{print $0}
/^\.$/{exit}
' ) | /usr/lib/sendmail -v -t
}
If I do this it works faultlessly (but vi is too "unfriendly" for the users)
vi /tmp/ssss
echo "$HEADERS" | cat - /tmp/ssss | $SM
I have tried
echo "$HEADERS" > /tmp/ssss.$$
while read line
do
if [ "$line" == "." ]
then
break
else
echo $line >> /tmp/ssss.$$
fi
done
$SM < /tmp/ssss.$$
++
Richard Mackerras Phone: 01275 81 6701
Unix Systems Administrator Fax: 01275 81 6265
Technical Services
Information Systems Department
Avon & Somerset Constabulary
PO Box 37
Police Headquarters
Portishead BS20 8QJ
External email: Richard.Mackerras@AvonAndSomerset.Police.UK
or: Richard.Mackerras@AvonAndSomerset.PNN.Police.UK
*******************************************************
Internet e-mail is not to be treated as a secure means
of communication. The Avon and Somerset Constabulary
monitors all internet e-mail activity and content.
This communication is confidential and intended for the
addressee(s) only. Unauthorised use or disclosure of
the content may be unlawful. Opinions expressed in
this document may not be official policy.
Thank you for your cooperation.
(C)Avon and Somerset Constabulary.
http://www.avonandsomerset.police.uk
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:24:13 EDT