Re: [t2t] Advice needed: Mysterious Files! - managementplangtorme.t2t (1/1)

2009-09-22 Thread John Plumridge
--On 21 September 2009 21 Sep-17:09:56  -0300 Aurélio Jargas
 wrote:

> Hi John,
> 
> All the file contents inside the  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(  ) {

   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® 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-12, 2009. Register now!
http://p.sf.net/sfu/devconf
___
txt2tags-list mailing list
https://lists.sourceforge.net/lists/listinfo/txt2tags-list


Re: [t2t] Advice needed: Mysterious Files! - managementplangtorme.t2t (1/1)

2009-09-22 Thread John Plumridge
--On 21 September 2009 21 Sep-17:09:56  -0300 Aurélio Jargas
 wrote:

> Hi John,
> 
> All the file contents inside the  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(  ) {

   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® 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-12, 2009. Register now!
http://p.sf.net/sfu/devconf
___
txt2tags-list mailing list
https://lists.sourceforge.net/lists/listinfo/txt2tags-list


Re: [t2t] Advice needed: Mysterious Files! - managementplangtorme.t2t (1/1)

2009-09-21 Thread Aurélio Jargas
Hi John,

All the file contents inside the  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


On Sun, Sep 20, 2009 at 06:24, John Plumridge  wrote:
> --On 19 September 2009 19 Sep-15:05:19  +0100 John Plum
>  wrote:
>
>> Text2tags works great. But I have an unsolved MYSTERY!
>>
>
> OK - sorted this out.
> It is a problem of mixed carriage returns in the files exported form
> Tinderbox, in  the header/namespace part of the note.
> I tried all sorts to clean this, including classic dos2unix script ( I am
> on os x).
>
> This script did work however (for file in one directory):
>  perl bin/bash/dos2unix.sh /file-path/*.txt
>
> Having started on a script thsat would recurse sub-directories, I found
> this excellent script, with an applescript drop app version too:
>
> ww.bekkoame.ne.jp/~n-iyanag/researchTools/batch_convert2utf8.html
>
>
> The result: perfectly useable text files, in t2t.
>
> John
>
>
>
>
>
>
> --
> Come build with us! The BlackBerry® 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-12, 2009. Register now!
> http://p.sf.net/sfu/devconf
> ___
> txt2tags-list mailing list
> https://lists.sourceforge.net/lists/listinfo/txt2tags-list
>



-- 
Aurélio | www.aurelio.net | @oreio

--
Come build with us! The BlackBerry® 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-12, 2009. Register now!
http://p.sf.net/sfu/devconf
___
txt2tags-list mailing list
https://lists.sourceforge.net/lists/listinfo/txt2tags-list


Re: [t2t] Advice needed: Mysterious Files! - managementplangtorme.t2t (1/1)

2009-09-20 Thread John Plumridge


--On 19 September 2009 19 Sep-15:05:19  +0100 John Plum
 wrote:

> Text2tags works great. But I have an unsolved MYSTERY!
> 

OK - sorted this out.
It is a problem of mixed carriage returns in the files exported form
Tinderbox, in  the header/namespace part of the note.
I tried all sorts to clean this, including classic dos2unix script ( I am
on os x).

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

Having started on a script thsat would recurse sub-directories, I found
this excellent script, with an applescript drop app version too:

ww.bekkoame.ne.jp/~n-iyanag/researchTools/batch_convert2utf8.html 


The result: perfectly useable text files, in t2t.

John






--
Come build with us! The BlackBerry® 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-12, 2009. Register now!
http://p.sf.net/sfu/devconf
___
txt2tags-list mailing list
https://lists.sourceforge.net/lists/listinfo/txt2tags-list