Re: strange behaviour in search for \n
Re: strange behaviour in search for \n
- Subject: Re: strange behaviour in search for \n
- From: Gnarlodious <email@hidden>
- Date: Thu, 01 Jul 2004 13:45:48 -0600
I find that that shell script do not normally change linendings to \n and
only a few commands demand \n (for example, "sort"). It's unwieldy and
superfluous.
So never use "without altering line endings" in a script.
In case you DO need \n, pipe the file through tr:
do shell script "tr '\\r' '\\n'<messedUpFilepath | sort -f > resultFile"
-- Gnarlie
Entity Charles Arthur spoke thus:
>
On Thu, 01 Jul 2004 12:38:42 +0100 Nigel Smith <email@hidden> wrote:
>
..(I wrote)
>
>> However if (in order not to have a dummy file that I write and read) I
>
>> include the curl command as part of "do shell script" and put the output
>
>> straight into a variable in the script, and then search using "</b>\n" and
>
>> "\n</font>" as the start and end points, it fails. I get an empty list for
>
>> the output of the search - my subroutine's way of saying "no such thing
>
>> here".
>
>
>
> Probably the result of "do shell script"'s autmatic line ending conversion,
>
> which is on by default.
>
>
Guh. Didn't know about *that*. What a truly sneaky gotcha. Of course SE
>
can't show you if a new line is a CR or LF..
>
>
> Try:
>
>
>
> set myVar to do shell script "whatever" altering line endings false
>
>
>
> ...instead.
>
>
>
> HTH,
>
>
Sure it wil. Thanks also to Emmanuel for that.
>
>
Charles
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.