Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Apple Script for copying a "part" from one txt file to a new txt file

I have a txt file which has data written in a particular format as below:

<MyTag>random data 1<\MyTag><MyTag>random data 2<\MyTag><MyTag>random data n<\MyTag>


My requirement is to copy the data within each tags to a separate file . eg: File1 should have <MyTag>random data 1<\MyTag>, File2 should have <MyTag>random data 2<\MyTag> and so on.


Please help..!!

Posted on Feb 25, 2013 7:36 AM

Reply
4 replies

Feb 25, 2013 8:11 AM in response to optimusfromkerala

The filename of the file that gets the text is always named after the text in the <>?


Will there be only one occurrence of each tag in a file or can a tag appear multiple times in different places in the file?


Do you want the <tag></tag> to also appear in the output file or just the text between the tag start and end?


Where do the output files live? In the same folder as the input file or another folder? Will the output files exist already and be appended to or are they created new for each input file each time?

Feb 25, 2013 8:23 AM in response to Frank Caggiano

1. Filename is imaterial and has nothing to do with the contents.

2. There can me multiple occurences, but this will always follow the following sructure. <tag><\tag><tag><\tag>...

the following case is not present <tag>affa<tag>afa<\tag><\tag>.


3. I want the <tag> <\tag> to appear in the output.


4. The output files can be in the same folder but these files need to be created for each input.(wont be present)

Apple Script for copying a "part" from one txt file to a new txt file

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.