Hi Billy,

unix2dos

#!/usr/local/bin/perl -w
while (<STDIN>) {
  chomp;
  if ( $0=~m/dos2unix$/ ) {
    print "$_\n";
  } else {
    print "$_\r\n";
  }
}

dos2unix

#!/usr/local/bin/perl -w
while (<STDIN>) {
  chomp;
  if ( $0=~m/dos2unix$/ ) {
    print "$_\n";
  } else {
    print "$_\r\n";
  }
}

On Friday 27 April 2001  7:43 am, Billy Joedono wrote:
> Hi,
>
> Thanks to all who commented. They are all correct. John Joseph's
> suggestion to use #!/usr/bin/per; -w would work too. But Jason's
> suggestion below pointed me to the solution. When the command perl
> test.pl work, right there I realize file format might be suspect. I
> pulled out my HEX editor and there they were, the <CR><LF> pairs. I
> didn't show in Linux vi the way it would in Solaris vi, neither would
> it in the GNU editor (which I use). Convert to regular Unix format
> and problem solved! More question: how can I force vi to show these,
> or better yet, how can I get dos2unix or unix2dos in Linux?
>
> The down-side of Linux understanding much of Windowz is that you
> never get subjected to these little finicky differences until you're
> struck by them.
>
> At 01:24 PM 4/27/2001 +1000, King, Jason wrote:
> >can you run it manually by passing it to the interpreter
> >
> >   perl test.pl
> >
> >?
> >
> >
> >--
> >   jason king
> >
> >   A Canadian law states that citizens may not publicly remove
> > bandages. - http://dumblaws.com/
>
> *********************************************************************
>****** Thanks and regards,
>          Billy Joedono
>
>          "Courtesy comes by default, but respect I gotta earn"
> *********************************************************************
>******

-- 
Gary Stainburn
 
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000 
    

Reply via email to