Re: carriage returns

2012-08-16 Thread David Kelly

On Aug 16, 2012, at 4:20 PM, Jim Sheffer wrote:

> David- - I ran the file via terminal through hexdump with no problem.  Can 
> you tell me what I'm looking for?

"What Patrick said."  :-)

0x0d is CR and 0x0a is LF, and hexdump knows nothing of line endings so what it 
dumps is exactly what is there.

The Hex Dump utility built into BBedit under the File menu is essentially the 
same thing as "hexdump -C" but with easier knobs to turn in a GUI. The output 
is a BBedit text file which is a bit easier to search and move around in than 
piping it into /usr/bin/more.

On PC there is a freeware utility called HxD which I make a lot of use of. It 
can do binary compares and jump to the point the files differ. Also useful for 
trimming binary files.

--
David Kelly N4HHE, dke...@hiwaay.net

Whom computers would destroy, they must first drive mad.



-- 
-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 





Re: carriage returns

2012-08-16 Thread Patrick Woolsey
At 16:20 -0500 08/16/2012, Jim Sheffer wrote:
[...]
>> b) When you open the .csv file in BBEdit, what is its line ending format?
>
>Windows - which is what I need.

OK; that means the generated file is almost certainly correct.


>I think I've found the problem.  The file was actually sent to my client,
>then on to the company who created the system they are using.
>I checked with my client and there file is also fine (no extra carriage
>returns.  It seems the company they sent it to opened in up in note pad
>lite and somehow IT is creating the extra carriage returns.
>

Wups :-)


>Of course they are saying it is me, so I wanted to make sure absolutely
>before I tell my client that the company is full of it :-)
>They have been a pain for both me and my client over this and it is quite
>annoying!
>

Sounds like you're on solid ground here but understood.


>David- - I ran the file via terminal through hexdump with no problem.  Can
>you tell me what I'm looking for?
>

I can give you a quick example as well.

First, for reference, "0D" is the hex value of a carriage return (CR, ASCII
13), and "0A" is the hex value of a line feed (LF, ASCII 10).

So, a CRLF pair would be "0D 0A", while two CRs in succession would be "0D
0D", etc. (The space in between is just for readability in the hex dump
output; it's not significant.)

Say you have a file with Windows line endings which contains this text:

the quick red fox
jumped over the lazy brown dog


and here's the resulting hex dump output:

: 74 68 65 20 71 75 69 63 6B 20 72 65 64 20 66 6F   the quick red fo
0010: 78 0D 0A 6A 75 6D 70 65 64 20 6F 76 65 72 20 74   x..jumped over t
0020: 68 65 20 6C 61 7A 79 20 62 72 6F 77 6E 20 64 6F   he lazy brown do
0030: 67 0D 0A  g..


You can now look and/or search* within this output for the expected line
break characters or character pairs, e.g.

: 74 68 65 20 71 75 69 63 6B 20 72 65 64 20 66 6F   the quick red fo
0010: 78 0D 0A 6A 75 6D 70 65 64 20 6F 76 65 72 20 74   x..jumped over t
 *   **
here's the CRLF pair which ends the first line of text, and

0030: 67 0D 0A  g..
 *   **
here's the CRLF pair which comes at the end of the file.

[* Note that because of the output formatting, the CR could appear at the
end of one report line and its following LF at the start of the next report
line.]


Regards,

 Patrick Woolsey
==
Bare Bones Software, Inc.  
P.O. Box 1048, Bedford, MA 01730-1048

-- 
-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 





Re: carriage returns

2012-08-16 Thread Jim Sheffer
Patrick & David-

thanks for the help!



On Aug 16, 2012, at 2:59 PM, Patrick Woolsey  wrote:

> At 12:17 -0500 08/16/2012, Jim Sheffer wrote:
> [...]
>> I have a file that creates a .csv file from dynamic database information.
>> At the end of each line, I have "\r\n" (without the quotes) to produce the
>> end of line.  I use \r\n because the file is being imported into a windows
>> machine.
>> 
> 
> Two questions if I may:
> 
> a) Are you creating the original .csv file outside of BBEdit, or within it?
I create the file that creates the .cvs file within BBEdit using Lasso.
> 
> b) When you open the .csv file in BBEdit, what is its line ending format?
Windows - which is what I need.
> 
>  (By default, BBEdit will display this in the status bar at the bottom
>   of the editing window.)
> 
I think I've found the problem.  The file was actually sent to my client, then 
on to the company who created the system they are using.
I checked with my client and there file is also fine (no extra carriage 
returns.  It seems the company they sent it to opened in up in note pad lite 
and somehow IT is creating the extra carriage returns.

Of course they are saying it is me, so I wanted to make sure absolutely before 
I tell my client that the company is full of it :-)
They have been a pain for both me and my client over this and it is quite 
annoying!

David- - I ran the file via terminal through hexdump with no problem.  Can you 
tell me what I'm looking for?

Thanks for all the quick help!

James Sheffer
> 
>> In BBEdit, with "Show Invisibles" I see the end on line character (or I
>> assume that is what it is- a "sideways" L character.
> 
> That is the visible marker for a hard line break, which _within an open
> document_ is always a carriage return (CR).
> 
> 
>> To test, I added \r\n twice and as I expectedand in the final .csv file,
>> BBedit shows me two of these characters.
>> 
>> Am I missing something?  The reason I ask is the new .csv files do not
>> import into the clients system and they are telling me that there are 2
>> carriage returns on each line.
>> 
> 
> In general, I recommend using BBEdit's automatic line ending support rather
> than trying to adjust this manually.
> 
> If BBEdit shows the .csv file has "Windows" line endings, the file should
> open normally on your client's system (or if not, something's likely
> modifying the file in transit).
> 
> If instead BBEdit shows this file has "Classic Mac" or "Unix" line endings,
> please change its line ending format to "Windows", then save it, and the
> resulting file should  open normally on your client's machine.
> 
> 
> 
> Regards,
> 
> Patrick Woolsey
> ==
> Bare Bones Software, Inc.  
> P.O. Box 1048, Bedford, MA 01730-1048
> 
> -- 
> -- 
> You received this message because you are subscribed to the 
> "BBEdit Talk" discussion group on Google Groups.
> To post to this group, send email to bbedit@googlegroups.com
> To unsubscribe from this group, send email to
> bbedit+unsubscr...@googlegroups.com
> For more options, visit this group at
> 
> If you have a feature request or would like to report a problem, 
> please email "supp...@barebones.com" rather than posting to the group.
> Follow @bbedit on Twitter: 
> 
> 


James Sheffer,

The HigherPowered Team!

supp...@higherpowered.com  sa...@higherpowered.com
Web Design & Development http://www.higherpowered.com
phone:  469-256-0268   
 "We help businesses succeed on the web!"
 ---

-- 
-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 





Re: carriage returns

2012-08-16 Thread Patrick Woolsey
At 15:59 -0400 08/16/2012, Patrick Woolsey wrote:
>At 12:17 -0500 08/16/2012, Jim Sheffer wrote:
>[...]
>>I have a file that creates a .csv file from dynamic database information.
>>At the end of each line, I have "\r\n" (without the quotes) to produce the
>>end of line.  I use \r\n because the file is being imported into a windows
>>machine.

and I said:
>In general, I recommend using BBEdit's automatic line ending support rather
>than trying to adjust this manually.
>
[... options elided ...]


PS: If for some reason the latter doesn't work, please send a note plus a
Zipped sample file to tech support  so we can take a
look.


Regards,

 Patrick Woolsey
==
Bare Bones Software, Inc.  
P.O. Box 1048, Bedford, MA 01730-1048

-- 
-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 





Re: carriage returns

2012-08-16 Thread Patrick Woolsey
At 12:17 -0500 08/16/2012, Jim Sheffer wrote:
[...]
>I have a file that creates a .csv file from dynamic database information.
>At the end of each line, I have "\r\n" (without the quotes) to produce the
>end of line.  I use \r\n because the file is being imported into a windows
>machine.
>

Two questions if I may:

a) Are you creating the original .csv file outside of BBEdit, or within it?

b) When you open the .csv file in BBEdit, what is its line ending format?

   (By default, BBEdit will display this in the status bar at the bottom
of the editing window.)


>In BBEdit, with "Show Invisibles" I see the end on line character (or I
>assume that is what it is- a "sideways" L character.

That is the visible marker for a hard line break, which _within an open
document_ is always a carriage return (CR).


>To test, I added \r\n twice and as I expectedand in the final .csv file,
>BBedit shows me two of these characters.
>
>Am I missing something?  The reason I ask is the new .csv files do not
>import into the clients system and they are telling me that there are 2
>carriage returns on each line.
>

In general, I recommend using BBEdit's automatic line ending support rather
than trying to adjust this manually.

If BBEdit shows the .csv file has "Windows" line endings, the file should
open normally on your client's system (or if not, something's likely
modifying the file in transit).

If instead BBEdit shows this file has "Classic Mac" or "Unix" line endings,
please change its line ending format to "Windows", then save it, and the
resulting file should  open normally on your client's machine.



Regards,

 Patrick Woolsey
==
Bare Bones Software, Inc.  
P.O. Box 1048, Bedford, MA 01730-1048

-- 
-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 





Re: carriage returns

2012-08-16 Thread David Kelly

On Aug 16, 2012, at 12:17 PM, Jim Sheffer wrote:

> So am I right to assume the "L" character is indeed a carriage return and 
> that with only one showing at the end of each line in the file and no spaces 
> between the lines, there can only be one carriage return for each line?

Just for curiosity open Terminal.app and look at the questioned file using 
"hexdump -C question.csv | more"

Of course that is very un-BBeditish so go to the bottom of the File menu where 
it says "Hex Dump" and use either Hex Dump File or Hex Dump Front Document to 
do the same as the above hexdump. This should answer your question as to what 
is where in no uncertain terms.

--
David Kelly N4HHE, dke...@hiwaay.net

Whom computers would destroy, they must first drive mad.





smime.p7s
Description: S/MIME cryptographic signature


carriage returns

2012-08-16 Thread Jim Sheffer
Hi everyone.  I mostly sit on the sidelines and try to soak up all the great 
posts but I need to clear something up.

I have a file that creates a .csv file from dynamic database information.  At 
the end of each line, I have "\r\n" (without the quotes) to produce the end of 
line.  I use \r\n because the file is being imported into a windows machine.

When I look at the file that is created, there are no spaces between each line.
I have been doing this for almost 15 year with no problems.

In BBEdit, with "Show Invisibles" I see the end on line character (or I assume 
that is what it is- a "sideways" L character.
To test, I added \r\n twice and as I expectedand in the final .csv file,  
BBedit shows me two of these characters.

Am I missing something?  The reason I ask is the new .csv files do not import 
into the clients system and they are telling me that there are 2 carriage 
returns on each line.

I have been having problems with them already so I don't have much confidence 
in them to begin with.  However, I don't want to tell them they are full of it 
until I am absolutely sure :-)

So am I right to assume the "L" character is indeed a carriage return and that 
with only one showing at the end of each line in the file and no spaces between 
the lines, there can only be one carriage return for each line?


James Sheffer,

The HigherPowered Team!

supp...@higherpowered.com  sa...@higherpowered.com
Web Design & Development http://www.higherpowered.com
phone:  469-256-0268   
 "We help businesses succeed on the web!"
 ---

-- 
-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 





Re: AppleScript or Automator support for converting text automatically

2012-08-16 Thread G. T. Stresen-Reuter
See Text Factories in the documentation. It will do exactly what you want with 
grace and style.


Sent from iPhone. Please excuse my brevity and misspellings.


On Aug 16, 2012, at 12:52 PM, Romain M  wrote:

> I couldn't find support for this action in Automator or AppleScript.
> 

-- 
-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 





AppleScript or Automator support for converting text automatically

2012-08-16 Thread Romain M
Hello

Is there a way to automate the process of converting a text to another 
encoding (in my case UTF16 Little Endian)?
Right now I have to open the csv file in BBEdit and save it as a new file 
with the different encoding.
I couldn't find support for this action in Automator or AppleScript.

Thanks

-- 
-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 





Re: update markup command line

2012-08-16 Thread Terje Bless
Hmm. It seems the regular denizens of the list are hibernating or
something. My AppleScript is a bit rusty, but...


On Mon, Aug 13, 2012 at 7:26 PM, jamie  wrote:
> is there a way to run Update > Markup to a folder or documents
> via command line or applescript?

Sure, you can do it with AppleScript (BBEdit is incredibly
scriptable!), and thus you can use any of the options for running an
AppleScript from the command line (osascript, or the Scripting Bridges
from Python or Ruby, or...). Something like this should work:

tell application "BBEdit"
(*
Here we get whatever we want to run the "update" on and stash it in a
variable. BBEdit's "update" command can work on a single file, a
folder, or a "site" defined in the preferences.
*)
set theDocument to active document of text window 1
set theFile to theDocument's file

-- The options (the with/without stuff) should be familiar from the
GUI, and details can be found in the user manual.
update theFile with skip shielded without nested and show results
end tell


> In Placeholders, is there a way to return the open document's current
> directory?

There's no predefined placeholder in BBEdit that returns the
document's basedir, but you can do it with an included AppleScript,
something along the lines of this:


-- AS handler function called by BBEDit for #bbinclude
on include(theFile, theVariables)
-- BBEdit gives us a file URL, which the Finder doesn't understand,
so coerce it into an alias.
set theAlias to theFile as alias

-- Ask the Finder to figure out the containing folder of our alias 
object...
tell application "Finder"
-- …and coerce the return type into an alias which is more
convenient to work with later.
set theFolder to theAlias's container as alias
end tell

-- Now we can either grab a Mac-style path...
set theMacPath to theFolder as string
-- …or a Unix-style path...
set theUnixPath to theFolder's POSIX path

-- …and return whichever version we want to BBEdit.
--  return theMacPath
return theUnixPath
end include

Cheers,
-link

-- 
-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: