Subject: | |
From: | |
Reply To: | |
Date: | Tue, 3 Nov 2009 23:30:54 +0100 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Hope this helps a bit:
set s to "a|b|c|d|e|row1col6|row1col7|rest
z|y|x|w|v|row2col6|row2col7|rest"
join (find text "^([^|]+\\|){5}([^|]+)\\|([^|]+)\\|" using "\\2" in
(get paragraphs of s) with regexp and string result) using "|"
-- row1col6|row2col6
join (find text "^([^|]+\\|){5}([^|]+)\\|([^|]+)\\|" using "\\3" in
(get paragraphs of s) with regexp and string result) using "|"
-- row1col7|row2col7
Emmanuel
On Nov 3, 2009, at 11:22 PM, [log in to unmask] wrote:
> Yes, that would be perfect.
>
> On Nov 3, 2009, at 1:29pm, Mark J. Reed wrote:
>
>> I'm not clear what you're asking. Given these lines:
>>
>> a|b|c|d|e|row1col6|row1col7|rest
>> z|y|x|w|v|row2col6|row2col7|rest
>> ...
>>
>> What do you want as output? Something like this?
>>
>> row1col6|row2col6|row3col6|...
>> row1col7|row2col7|row3col7|...
>>
>>
>> On Tue, Nov 3, 2009 at 4:08 PM, [log in to unmask]
>> <[log in to unmask]> wrote:
>>> I need some quick GREP advice.
>>>
>>> I'm working with a pipe delimited data file in this format:
>>>
>>> 114|20090826|00:00|N|1800|8005082|6719954|TVPG|L||CC|Stereo|N|
>>> Color||N|N|N|4:3
>>> Fullscreen|N||||Y
>>>
>>> The 6th and 7th items in the each row of data (|8005082|6719954|,
>>> from the
>>> example) are references to data in other files.
>>>
>>> So what I need is a grep command that will give me 2 lists, one
>>> containing
>>> the 6th number from each row and one containing the 7th.
>>>
>>> The lists could be pipe, comma, tab or return delimited
>>>
>>> I'm fairly sure this can be done via GREP, but I don't know where
>>> to start.
>>>
>>> Any suggestions?
>>>
>>
>>
>>
>> --
>> Mark J. Reed <[log in to unmask]>
|
|
|