[Fwd: Re: ctrl-M]

[Fwd: Re: ctrl-M]

am 27.08.2003 21:48:08 von Shawn Ashlee

(Freddie)Here is the snippet:
echo "$2" | sed -e 's/\./\\./g' > /tmp/add_to_proc.tmp
TEMPFILE=`cat /tmp/sed/add_to_proc.tmp`;

echo -e "
# $2 start\r
:0:\r
* ^From: .*$TEMPFILE.*\r
/dev/null\r
# $2 end\r
" >> $PROCFILE

echo "Sucessfully added $2 to $PROCFILE"
exit 0

This is just for a Linux box, it will not be moved to dos. The "only"
problem with the ctrl-M is that procmail will not read the file with
those in there. Like I said, it shows them in vi but not when you cat
the file.

Shawn

-------- Original Message --------
From: - Wed Aug 27 12:43:23 2003
X-UIDL: 3f4d06fb00000001
X-Mozilla-Status: 0011
X-Mozilla-Status2: 00000000
Return-Path:
Received: from virt19x.secure-wi.com (root@localhost) by ashlee.info
(8.11.6/8.11.6) with ESMTP id h7RJRP401864 for ; Wed,
27 Aug 2003 12:27:25 -0700
X-ClientAddr: 217.116.160.18
Received: from ns.tumsan.fi (mail.tumsan.fi [217.116.160.18]) by
virt19x.secure-wi.com (8.11.6/8.11.6) with ESMTP id h7RJRMl01805 for
; Wed, 27 Aug 2003 12:27:23 -0700
Received: from mouse.tumsan.fi (mouse.tumsan.fi [217.116.165.11]) by
ns.tumsan.fi (8.11.2/8.11.0/SuSE Linux 8.11.0-0.4) with ESMTP id
h7RJR6210842 for ; Wed, 27 Aug 2003 22:27:06 +0300
Message-Id: <5.1.0.14.0.20030827221350.00b15820@217.116.160.18>
X-Sender: freddie@217.116.160.18
X-Mailer: QUALCOMM Windows Eudora Version 5.1
Date: Wed, 27 Aug 2003 22:14:28 +0300
To: Shawn Ashlee
From: freddie
Subject: Re: ctrl-M
In-Reply-To: <3F4D0079.9060106@ashlee.info>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"; format=flowed
X-MailScanner: Found to be clean
Status: O

could you post up your script (or at least the part that does the writing)?

>I have a bash script writting to a .procmailrc file, but it is putting in
>ctrl-M's where I have \r or \015. You can see them in vi but not when you
>cat the file. It wouldn't be a problem, but procmail cant read it with
>those in there. I tried \n, but it adds alot of blank lines.
>The archives mostly talk about compatability for dos/linux, but that
>doesnt help me.
>
>Thanks,
>Shawn
>
>
>
>-
>To unsubscribe from this list: send the line "unsubscribe linux-admin" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at http://vger.kernel.org/majordomo-info.html
>





-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [Fwd: Re: ctrl-M]

am 27.08.2003 22:05:06 von Tim Walberg

Remove the "\r" bits... The newline that follows each
of them is already embedded in the string which you are
echo-ing, so the file should look like you expect...

Another way to do this that might be slightly
easier than the echo statement would be to
use the "here-document" feature (although
a performance nazi might point out that the
binary for cat takes up slightly more memory
than that for echo):

cat > $PROCFILE < # $2 start
....
....
EOF


On 08/27/2003 12:48 -0700, Shawn Ashlee wrote:
>> (Freddie)Here is the snippet:
>> echo "$2" | sed -e 's/\./\\./g' > /tmp/add_to_proc.tmp
>> TEMPFILE=`cat /tmp/sed/add_to_proc.tmp`;
>>
>> echo -e "
>> # $2 start\r
>> :0:\r
>> * ^From: .*$TEMPFILE.*\r
>> /dev/null\r
>> # $2 end\r
>> " >> $PROCFILE
>>
>> echo "Sucessfully added $2 to $PROCFILE"
>> exit 0
>>
>> This is just for a Linux box, it will not be moved to dos. The "only"
>> problem with the ctrl-M is that procmail will not read the file with
>> those in there. Like I said, it shows them in vi but not when you cat
>> the file.
>>
>> Shawn
>>
>> -------- Original Message --------
>> From: - Wed Aug 27 12:43:23 2003
>> X-UIDL: 3f4d06fb00000001
>> X-Mozilla-Status: 0011
>> X-Mozilla-Status2: 00000000
>> Return-Path:
>> Received: from virt19x.secure-wi.com (root@localhost) by ashlee.info
>> (8.11.6/8.11.6) with ESMTP id h7RJRP401864 for ; Wed,
>> 27 Aug 2003 12:27:25 -0700
>> X-ClientAddr: 217.116.160.18
>> Received: from ns.tumsan.fi (mail.tumsan.fi [217.116.160.18]) by
>> virt19x.secure-wi.com (8.11.6/8.11.6) with ESMTP id h7RJRMl01805 for
>> ; Wed, 27 Aug 2003 12:27:23 -0700
>> Received: from mouse.tumsan.fi (mouse.tumsan.fi [217.116.165.11]) by
>> ns.tumsan.fi (8.11.2/8.11.0/SuSE Linux 8.11.0-0.4) with ESMTP id
>> h7RJR6210842 for ; Wed, 27 Aug 2003 22:27:06 +0300
>> Message-Id: <5.1.0.14.0.20030827221350.00b15820@217.116.160.18>
>> X-Sender: freddie@217.116.160.18
>> X-Mailer: QUALCOMM Windows Eudora Version 5.1
>> Date: Wed, 27 Aug 2003 22:14:28 +0300
>> To: Shawn Ashlee
>> From: freddie
>> Subject: Re: ctrl-M
>> In-Reply-To: <3F4D0079.9060106@ashlee.info>
>> Mime-Version: 1.0
>> Content-Type: text/plain; charset="us-ascii"; format=flowed
>> X-MailScanner: Found to be clean
>> Status: O
>>
>> could you post up your script (or at least the part that does the writing)?
>>
>> >I have a bash script writting to a .procmailrc file, but it is putting in
>> >ctrl-M's where I have \r or \015. You can see them in vi but not when you
>> >cat the file. It wouldn't be a problem, but procmail cant read it with
>> >those in there. I tried \n, but it adds alot of blank lines.
>> >The archives mostly talk about compatability for dos/linux, but that
>> >doesnt help me.
>> >
>> >Thanks,
>> >Shawn
>> >
>> >
>> >
>> >-
>> >To unsubscribe from this list: send the line "unsubscribe linux-admin" in
>> >the body of a message to majordomo@vger.kernel.org
>> >More majordomo info at http://vger.kernel.org/majordomo-info.html
>> >
>>
>>
>>
>>
>>
>> -
>> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
End of included message



--
+--------------------------+------------------------------+
| Tim Walberg | twalberg@mindspring.com |
| 830 Carriage Dr. | www.mindspring.com/~twalberg |
| Algonquin, IL 60102 | |
+--------------------------+------------------------------+
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [Fwd: Re: ctrl-M]

am 27.08.2003 22:06:09 von fred orispaa

well like some people said, the simple answer is to add for example
"dos2unix $PROCFILE" to the end of your script. but thats not "elegant", if
such things matter to you.
the \r is your culprit. that creates a ctrl-m. \n doesnt. im going to
assume \r is CR/LF and \n is just LF...
i would also shorten the script like the following example, but thats a
matter of taste of course:
echo "$2" | sed -e 's/\./\\./g' > /tmp/add_to_proc.tmp
TEMPFILE=`cat /tmp/sed/add_to_proc.tmp`;
echo -e "# $2 start\n:0:\n* ^From:.*$TEMPFILE.*\n/dev/null\n# $2 end\n" >>
$PROCFILE
echo "Sucessfully added $2 to $PROCFILE"
exit 0


>(Freddie)Here is the snippet:
> echo "$2" | sed -e 's/\./\\./g' > /tmp/add_to_proc.tmp
> TEMPFILE=`cat /tmp/sed/add_to_proc.tmp`;
>
> echo -e "
> # $2 start\r
> :0:\r
> * ^From: .*$TEMPFILE.*\r
> /dev/null\r
> # $2 end\r
> " >> $PROCFILE
>
> echo "Sucessfully added $2 to $PROCFILE"
> exit 0
>
>This is just for a Linux box, it will not be moved to dos. The "only"
>problem with the ctrl-M is that procmail will not read the file with those
>in there. Like I said, it shows them in vi but not when you cat the file.
>
>Shawn
>
>-------- Original Message --------
>From: - Wed Aug 27 12:43:23 2003
>X-UIDL: 3f4d06fb00000001
>X-Mozilla-Status: 0011
>X-Mozilla-Status2: 00000000
>Return-Path:
>Received: from virt19x.secure-wi.com (root@localhost) by ashlee.info
>(8.11.6/8.11.6) with ESMTP id h7RJRP401864 for ;
>Wed, 27 Aug 2003 12:27:25 -0700
>X-ClientAddr: 217.116.160.18
>Received: from ns.tumsan.fi (mail.tumsan.fi [217.116.160.18]) by
>virt19x.secure-wi.com (8.11.6/8.11.6) with ESMTP id h7RJRMl01805 for
>; Wed, 27 Aug 2003 12:27:23 -0700
>Received: from mouse.tumsan.fi (mouse.tumsan.fi [217.116.165.11]) by
>ns.tumsan.fi (8.11.2/8.11.0/SuSE Linux 8.11.0-0.4) with ESMTP id
>h7RJR6210842 for ; Wed, 27 Aug 2003 22:27:06 +0300
>Message-Id: <5.1.0.14.0.20030827221350.00b15820@217.116.160.18>
>X-Sender: freddie@217.116.160.18
>X-Mailer: QUALCOMM Windows Eudora Version 5.1
>Date: Wed, 27 Aug 2003 22:14:28 +0300
>To: Shawn Ashlee
>From: freddie
>Subject: Re: ctrl-M
>In-Reply-To: <3F4D0079.9060106@ashlee.info>
>Mime-Version: 1.0
>Content-Type: text/plain; charset="us-ascii"; format=flowed
>X-MailScanner: Found to be clean
>Status: O
>
>could you post up your script (or at least the part that does the writing)?
>
>>I have a bash script writting to a .procmailrc file, but it is putting in
>>ctrl-M's where I have \r or \015. You can see them in vi but not when you
>>cat the file. It wouldn't be a problem, but procmail cant read it with
>>those in there. I tried \n, but it adds alot of blank lines.
>>The archives mostly talk about compatability for dos/linux, but that
>>doesnt help me.
>>
>>Thanks,
>>Shawn
>>
>>
>>
>>-
>>To unsubscribe from this list: send the line "unsubscribe linux-admin" in
>>the body of a message to majordomo@vger.kernel.org
>>More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
>
>
>
>-
>To unsubscribe from this list: send the line "unsubscribe linux-admin" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at http://vger.kernel.org/majordomo-info.html
>


-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [Fwd: Re: ctrl-M]

am 29.08.2003 07:12:02 von Stephen Samuel

freddie wrote:
> the \r is your culprit. that creates a ctrl-m. \n doesnt. im going to
> assume \r is CR/LF and \n is just LF...

\r will simply generate a ctrl-m ... wherever in the line it is.
If you put it at the end of a line, the implicit \n will get printed
after it (resulting in the well-known cr/lf pair.

\n will generate an extra LF, but it's not necessary at the end of
a line, because it's implicitly there already.
--
Stephen Samuel +1(604)876-0426 samuel@bcgreen.com
http://www.bcgreen.com/~samuel/
Powerful committed communication. Transformation touching
the jewel within each person and bring it to life.

-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html