Re: GREP pattern to replace the first element with a tab

2021-03-20 Thread John Delacour
On 20 Mar 2021, at 16:33, samar mailto:arnet...@bluewin.ch>> wrote: > ...when I run the text filter, not all occurrences of the first element get > replaced when necessary: > > > > Here a tab should also replace A1 in line 5, A2 in line 12, and A3 in line 18. That makes no sense to me. If

Re: GREP pattern to replace the first element with a tab

2021-03-20 Thread Christian Boyce
You asked for GREP, and this isn’t GREP, but it still solves your problem. I used AppleScript. Note: this script is written in order to be as easy to follow as possible. It could be improved of course. Basically I’m going down your document a line at a time, comparing what’s on the left

Re: GREP pattern to replace the first element with a tab

2021-03-20 Thread samar
Thank you! This is helpful, and the result better than mine was. However, when I run the text filter, not all occurrences of the first element get replaced when necessary: [image: tab3.png] Here a tab should also replace A1 in line 5, A2 in line 12, and A3 in line 18. Thanks samar On

Re: GREP pattern to replace the first element with a tab

2021-03-20 Thread John Delacour
On 20 Mar 2021, at 11:30, samar wrote: > I'm looking for something which I assume is pretty easy to accomplish with > GREP but I fail to see how. > > I have a large text file with entries sorted in this way: > > ...That is, the first element is replaced by a tab character *if* the first >

GREP pattern to replace the first element with a tab

2021-03-20 Thread samar
Hi This is the first time a post a message here. I'm looking for something which I assume is pretty easy to accomplish with GREP but I fail to see how. I have a large text file with entries sorted in this way: [image: tab1.png] That is, each line has two elements (represented here by A\d and