justcasper
justcasper

Reputation: 396

Loop pcregrep and get one match per index

i try to put all pcregrep matches in a loop but when i have two matches in one line or only the second match. I would like to loop it with one match per loop-index. this is what i have now but i just get the second match:

pcregrep -o1 -r --exclude-dir="_copy" "^.*LLL:EXT:(.*)['\"].*$" Resources/Private/Templates/ContentElements

Example Filecontent:

="panels"
             label="LLL:EXT:xxx/Resources/Private/Language/locallang.xlf:flux.m-alert.sheets.panels">
<flux:field.select name="color"
                   label="LLL:EXT:xxx/Resources/Private/Language/locallang.xlf:flux.m-alert.color"
                   items="{ivs:bootstrap.colors()}"
/>
<flux:field.select name="color"
                   label="LLL:EXT:xxx/Resources/Private/Language/locallang.xlf:flux.m-alert.color"
                   items="{
                       0:{
                           0:'LLL:EXT:xxx/Resources/Private/Language/locallang.xlf:bootstrap.color.primary.key', 1:'LLL:EXT:xxx/Resources/Private/Language/locallang.xlf:bootstrap.color.primary.value'
                       }
                   }"
/>

<flux:grid>
    <flux:grid.row>
        <flux:grid.column colPos="0"
                          name="content"
                          label="LLL:EXT:xxx/Resources/Private/Language/locallang.xlf:flux.content"/>
    </flux:grid.row>
</flux:grid>

</flux:form.sheet>

Result:

xxx/Resources/Private/Language/locallang.xlf:flux.m-alert.sheets.panels
xxx/Resources/Private/Language/locallang.xlf:flux.m-alert.color
xxx/Resources/Private/Language/locallang.xlf:flux.m-alert.color
xxx/Resources/Private/Language/locallang.xlf:bootstrap.color.primary.value
xxx/Resources/Private/Language/locallang.xlf:flux.content

Expected Result:

xxx/Resources/Private/Language/locallang.xlf:flux.m-alert.sheets.panels
xxx/Resources/Private/Language/locallang.xlf:flux.m-alert.color
xxx/Resources/Private/Language/locallang.xlf:flux.m-alert.color
xxx/Resources/Private/Language/locallang.xlf:bootstrap.color.primary.key
xxx/Resources/Private/Language/locallang.xlf:bootstrap.color.primary.value
xxx/Resources/Private/Language/locallang.xlf:flux.content

Upvotes: 0

Views: 65

Answers (0)

Related Questions