Re: using grep in a do shell script
Re: using grep in a do shell script
- Subject: Re: using grep in a do shell script
- From: Gnarlodious <email@hidden>
- Date: Mon, 24 Jan 2005 17:11:18 -0700
Maybe this is more what you want:
do shell script "sed -n '/<ram>/{s/.*<ram>\\(.*\\)<\\/ram>.*/\\1/p;}'
~/Library/Preferences/Fonovisa.xml"
-- Gnarlie
Entity Graham Anderson spoke thus:
> this does not quite work...but is it a bit closer ?
> many thanks
> set my_path to (path to preferences) & "Fonovisa.xml" as string
> set thepath to POSIX path of my_path
> loadTextFile(thepath)
> on loadTextFile(thepath)
> try
> set thestring to ""
> set theScript to ("cat " & "'" & thepath & "'")
> set thestring to do shell script theScript
> --return thestring
> set gimme to do shell script "echo " & thestring & " | tr '\\r' '\\n'
> | sed -n '/<ram>/{s/.*<ram>\\(.*\\)<\\/ram>.*/\\1/p;}' "
> return gimme
> on error err
> log ("Cat text file error: " & err)
> end try
> end loadTextFile
> On Jan 24, 2005, at 3:26 PM, Gnarlodious wrote:
>> Entity Graham Anderson spoke thus:
>>
>>> if I have an xml tag
>>> <ram>512</ram> in an xml file...
>>> how can I get the '512' out of it
>>
>> set someText to "
>> if I have an xml tag
>> <ram>512</ram> in an xml file...
>> how can I get the 512 out of it
>> this is what I have so far...currently it returns the whole xml file
>> just not sure how to do the same with a local file
>> 3rd day in applescript learning curve...
>> many thanks
>> "
>>
>> do shell script "echo " & quoted form of someText & " | tr '\\r' '\\n'
>> | sed -n '/<ram>/{s/.*<ram>\\(.*\\)<\\/ram>.*/\\1/p;}' "
>>
>>
>> -- Gnarlie _______________________________________________
> _______________________________________________
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden