--On 21 September 2009 21 Sep-17:09:56  -0300 Aurélio Jargas
<ve...@aurelio.net> wrote:

> Hi John,
> 
> All the file contents inside the <TITLE> was a hint about a line break
> problem, showing that txt2tags was not detecting it. I'm glad you
> managed to solve it, thanks for sharing!
> 
> Bye


Thank yo Aurelio:
--I previously wrote:

>> This script did work however (for file in one directory):
>>  perl bin/bash/dos2unix.sh /file-path/*.txt

Correction/update: I had employed the following line in my own dos2unix
script - not a existing one:

 perl -pe 's/\r\n|\n|\r/\n/g'   inputfile > outputfile  # Convert to UNIX  

#A script for all files in a directory:

#!/usr/bin/perl -w

   #

   #   Perl equivalent of the popular dos2unix utility:

   #

   #   Convert DOS line endings to Unix line endings:

   #   works in bulk, safely updates files in place.

   #

   my  ($filename, $line, $count);

   $count = 0;



   #   If no arguments, print an error message

   if( $#ARGV < 0 ) {

       print "Usage: $0 filenames\n";

       print ";Replace DOS line endings with Unix line endings\n";

       exit(5);

       }




   #   Loop through each given filename

   foreach $filename (@ARGV)

   {

       if( -e "$filename.bak" ) {

           printf "Skipping $filename.bak - it already exists\n";

       }

       elsif(!( -f $filename && -r $filename && -w $filename  )) {

           printf "Skipping $filename - not a regular writable file\n";

       }

       else {

           rename("$filename","$filename.bak");

           open INPUT, "$filename.bak";

           open OUTPUT, ">$filename";



           while( <INPUT> ) {

               s/\r\n|\n|\r/\n/g;     # convert CR LF to LF

               print OUTPUT $_;

           }



           close INPUT;

           close OUTPUT;

           unlink("$filename.bak");

           $count++;

       }

   }

   printf "Processed $count files.\n";


#The scripts I gave with a URL,in my previous post, are a better final
solution, in that they recurse directories.







------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
txt2tags-list mailing list
https://lists.sourceforge.net/lists/listinfo/txt2tags-list

Reply via email to