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

2021-03-21 Thread Bruce Van Allen
On 21 Mar 2021, at 19:37, Christopher Stone wrote: On 03/21/2021, at 03:39, samar > wrote: The reason you cannot reproduce the error with your file may be that the second column is limited to three different texts (B1, B2, and B3) whereas in mine there are more

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

2021-03-21 Thread Christopher Stone
On 03/21/2021, at 03:39, samar mailto:arnet...@bluewin.ch>> wrote: > The reason you cannot reproduce the error with your file may be that the > second column is limited to three different texts (B1, B2, and B3) whereas in > mine there are more (up to B7 here, but the script should also work with

Find/Replace with Regex expression

2021-03-21 Thread 'Ken Brown' via BBEdit Talk
I had not used grep Find/Replace regex for awhile, let me take this time to thank the developers of BBEdit for the great help in the Find/Replace dialog ? Button, and the way that the 'show matches' checkbox causes highlights for the operation of the potential find! Yay! Thx, Ken G. Brown --

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

2021-03-21 Thread Kaveh Bazargan
Glad it helped Samar. Yes, I am generally afraid of lookaheads and sometime not sure of why we can't just use a pattern and replace it verbatim, but this is a good case for it because you have to ensure you do not select the start of the next line in the grep search. The thing I find hardest is

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

2021-03-21 Thread samar
Very clever! I had not thought of using positive lookahead, but this indeed makes GREP work here. The only thing I had to add was a tab character before the closing parenthesis in the first search so that similar A1 values (those beginning in the same way) will be excluded:

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

2021-03-21 Thread samar
Wow, thank you, Christian, that works exactly as expected! (I only needed to change the closing quotation mark for the script to run.) This is very helpful – my 8,000-line file was magically modified within 8 seconds. samar On Saturday, March 20, 2021 at 8:13:30 PM UTC+1 ChristianBoyce wrote:

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

2021-03-21 Thread Kaveh Bazargan
Here is a two stage regex solution. Assuming no bullets (•) in your file, Search: ^([^\t]+)\t([^\t]+)\r(?=\1) replace: \1\t\2\r• Search: •[^\t]+ Replace with empty On Sun, 21 Mar 2021 at 08:47, Christopher Stone wrote: > On 03/20/2021, at 15:48, John Delacour wrote: > > That makes no sense

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

2021-03-21 Thread samar
Hi Chris (For some reason my messages here occur only several hours after I've sent them ...) Thank you very much indeed – your AppleScript works perfectly well here (8 seconds when applied to my file of 8,000 lines), the result is the same as when I run Christian's script. So I can even

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

2021-03-21 Thread samar
The reason you cannot reproduce the error with your file may be that the second column is limited to three different texts (B1, B2, and B3) whereas in mine there are more (up to B7 here, but the script should also work with more than seven): A1B1 A1B2 A1B3 A1B4 A1B5 A1

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

2021-03-21 Thread Christopher Stone
On 03/20/2021, at 15:48, John Delacour mailto:johndelac...@gmail.com>> wrote: > That makes no sense to me. If the current col1 is identical to col1 of the > previous line, then the value will not be printed; that is the clear logic of > the routine. I cannot reproduce your error. Hey Folks,

Re: Deleting a file via AppleScript

2021-03-21 Thread MediaMouth
Hi Alfredo, I wonder if a solution here is rsync. This is a command line app that can easily be run from AppleScript. It 'syncs' two directories, a source to a dest (in your case alpha (pre-production) to beta (production)) rsync -avu '/path/to/alpha/directory' '/path/to/beta/directory' This

Re: Deleting a file via AppleScript

2021-03-21 Thread Christopher Stone
On 03/19/2021, at 19:32, F. Alfredo Rego mailto:f.alfredor...@gmail.com>> wrote: > In the end, MediaMouth's was the simplest, as a one-liner that abstracted > Jean’s multi-liner: >> tell application "Finder" to delete POSIX file >> "/Volumes/ExternalVolume/Path/To/File" > ... > Footnote to