Here's a perl version of dos2unix that I wrote for a similar purpose.
if you save it as dos2unix, you'd type
dos2unix < file_to_process > file_processed.
#!/usr/bin/perl
while ($linein = <STDIN>) {
$linein =~ s/[\r]//g;
print "$linein";
}
Note that it expects perl in /usr/bin. If you have it somewhere else,
make sure to modify the first line accordingly.
Hope this helps,
-otto
-----Original Message-----
From: Pranita S [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 14, 2000 9:27 AM
To: [EMAIL PROTECTED]
Subject: Re: carriage return
Hi,
As many of you suggested to use sed to
get rid of carriage return ;
sed -e "s/\r/\n/g" your_file_name >
your_temp_file_name
But, this removes all occurances of r .
If i use
sed -e "s/\\r/\\n/g" your_file_name >
your_temp_file_name
It does the same thing.
Also, in vi when I say set list it shows only a $
at the end.
Pl. reply soon.
Thanks a lot.
--- Pranita S <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> We are currently porting a product that runs
> on NT to Linux.
> We use CVS as our source control system.
>
> The problem is :
> when we get a file on Linux it has \r\n as a
> newline character.
> If we have a muilt-line macro like
> #defined xyz \
> abc \
> pqr
>
> Then the gcc compiler (2.92.2) gives error as :
> stray '\' in program
>
> We do not want to write the macro on one-line as
> it is not readable. Also, we do not want to have
> single line for Linux and Multi-line for NT.
>
> Our guess is that it is probably due to \r .
>
> How do we get rid of \r on Linux ? (we are
> using multi-line macros in many files.)
> But, then it should work on NT also.
>
> Pl. reply soon.
>
> Thanks a lot.
>
> Pranita.
>
>
>
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Calendar - Get organized for the holidays!
> http://calendar.yahoo.com/
>
__________________________________________________
Do You Yahoo!?
Yahoo! Calendar - Get organized for the holidays!
http://calendar.yahoo.com/
_______________________________________________
Redhat-devel-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-devel-list
_______________________________________________
Redhat-devel-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-devel-list