Re: Help with a GREP task

2022-07-03 Thread David Brostoff
On Jul 3, 2022, at 3:17 PM, Rod Buchanan  wrote:
> 
> Don't enter the '$'.  I was showing the shell prompt (in my case, the bash 
> shell).  I probably should've left that out.

No problem of course -- now it works great. (In case it matters, I am using 
Monterey, so the default is zsh.)

Thank you very much -- again I have learned a lot.

David

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/218A2DD7-34F8-44BC-9B1F-7CE205A77748%40earthlink.net.


Re: Help with a GREP task

2022-07-03 Thread Rod Buchanan


-- 
Rod

> On Jul 3, 2022, at 2:35 PM, David Brostoff  wrote:
> 
> On Jul 3, 2022, at 10:07 AM, Rod Buchanan  wrote:
>> 
>> Another command-line option would be to use cut.  Assuming the fields are 
>> separated by a space:
>> 
>>  $ cut -d ' ' -f1 source_file.txt > output_file_1.txt
>>  $ cut -d ' ' -f2 source_file.txt > output_file_1.txt
>> 
>> Where:
>> 
>>  -d ‘ ‘  Tells cut the fields are separated by a space
>>  -f 1Specifieds the field, in this case 
>> field 1
>>  source_file.txt the name of the file containing the data
>>  output_file_1.txt   the name of the file you want the output placed 
>> in
> 
> Thank you for this interesting tip.
> 
> I now know how to specify the output path by dragging the output file to the 
> command line when the item it is replacing is the last one in the command, 
> but how do I do it for an item in the middle of the command?
> 
> Also, when I entered the above text in Terminal to try it out, I got the 
> error message "zsh: command not found: $". 

Don't enter the '$'.  I was showing the shell prompt (in my case, the bash 
shell).  I probably should've left that out.


-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/94BE267C-F191-4391-BBD4-EED1AC529FB3%40sofstats.com.


Re: Help with a GREP task

2022-07-03 Thread Rod Buchanan


One correction ... the second command s/b:

$ cut -d ' ' -f2 source_file.txt > output_file_2.txt

As I sent it the second command will overwrite the file created by the first 
command.

Apologies for missing that.

-- 
Rod

> On Jul 3, 2022, at 2:35 PM, David Brostoff  wrote:
> 
> On Jul 3, 2022, at 10:07 AM, Rod Buchanan  wrote:
>> 
>> Another command-line option would be to use cut.  Assuming the fields are 
>> separated by a space:
>> 
>>  $ cut -d ' ' -f1 source_file.txt > output_file_1.txt
>>  $ cut -d ' ' -f2 source_file.txt > output_file_1.txt
>> 
>> Where:
>> 
>>  -d ‘ ‘  Tells cut the fields are separated by a space
>>  -f 1Specifieds the field, in this case 
>> field 1
>>  source_file.txt the name of the file containing the data
>>  output_file_1.txt   the name of the file you want the output placed 
>> in
> 
> Thank you for this interesting tip.
> 
> I now know how to specify the output path by dragging the output file to the 
> command line when the item it is replacing is the last one in the command, 
> but how do I do it for an item in the middle of the command?
> 
> Also, when I entered the above text in Terminal to try it out, I got the 
> error message "zsh: command not found: $". 
> 
> David
> 
> -- 
> This is the BBEdit Talk public discussion group. If you have a feature 
> request or need technical support, please email "supp...@barebones.com" 
> rather than posting here. Follow @bbedit on Twitter: 
> 
> --- 
> You received this message because you are subscribed to the Google Groups 
> "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to bbedit+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/bbedit/C5AD7034-128B-4D1E-BF65-971A06CE6861%40earthlink.net.



-- 
Rod

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/AB182DF6-A361-4EEF-BB3C-4983AD9D3F4E%40sofstats.com.


Re: Help with a GREP task

2022-07-03 Thread David Brostoff
On Jul 3, 2022, at 1:26 PM, David Kelly  wrote:
> 
> As I originally stated, you now invoke the script file with 
> "awk -f script.awk " with a trailing space then drag your input file to the 
> command line to finish.
> 
> -f tells awk to get its commands from the specified file rather than the 
> command line.

Thanks for the detailed explanation and your patience --  this worked great and 
I really learned a lot.

This is the most helpful email list I have ever been on.

David

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/5B43F7C5-076B-4060-A50C-1E36286A07CC%40earthlink.net.


Re: Help with a GREP task

2022-07-03 Thread David Brostoff
On Jul 3, 2022, at 12:54 PM, Christopher Waterman  wrote:
> 
> It seems like you are missing some fundamentals when dealing with the command 
> line and paths and such.

Yes, missing almost all the fundamentals (except for knowing how to create a 
POSIX style path), so thank you for the very clear explanation, which worked 
great.

By the way, these days I don't have use for this kind of thing very often -- or 
else I would take the time to learn it from scratch instead of filling in 
someone else's generously provided template -- but it's extremely interesting 
to see its potential.

David


-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/9DE67646-8A7B-4686-B8B7-E68C6D58DA35%40earthlink.net.


Re: Help with a GREP task

2022-07-03 Thread David Kelly



On Jul 3, 2022, at 1:43 PM, David Brostoff  wrote:

> On Jul 3, 2022, at 7:26 AM, David Kelly  wrote:
>> 
>> Create an awk script file. Lets call it "script.awk" that looks like this:
>> 
>>  {
>>  print $1 >> "col-1.txt"
>>  print $2 >> "col-2.txt"
>>  }
> 
> Is creating an awk script file different from entering the above script in 
> Terminal?
> 
> If not, do I add "awk" before the leading curly bracket?

No, create a file exactly as shown above. 4 lines. Use a tab or a space or many 
spaces, it doesn't matter.

The difference is by putting the script (awk commands) in a file we don't have 
to figure out how to escape the newline between the two actions. That kind of 
thing varies depending on what shell you are using in Terminal.

Also putting the script in a file lets you create very complex scripts.

macOS Monterey seems to come with every popular Unix shell: sh, csh, tcsh, zsh, 
and bash. zsh seems to be the default now.

As I originally stated, you now invoke the script file with 
"awk -f script.awk " with a trailing space then drag your input file to the 
command line to finish.

-f tells awk to get its commands from the specified file rather than the 
command line.


--
David Kelly N4HHE, dke...@hiwaay.net

Whom computers would destroy, they must first drive mad.

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/4396EBB4-B040-4842-8D98-C87E502DB10E%40hiwaay.net.


Re: Help with a GREP task

2022-07-03 Thread David Brostoff
On Jul 3, 2022, at 10:07 AM, Rod Buchanan  wrote:
> 
> Another command-line option would be to use cut.  Assuming the fields are 
> separated by a space:
> 
>   $ cut -d ' ' -f1 source_file.txt > output_file_1.txt
>   $ cut -d ' ' -f2 source_file.txt > output_file_1.txt
> 
> Where:
> 
>   -d ‘ ‘  Tells cut the fields are separated by a space
>   -f 1Specifieds the field, in this case 
> field 1
>   source_file.txt the name of the file containing the data
>   output_file_1.txt   the name of the file you want the output placed 
> in

Thank you for this interesting tip.

I now know how to specify the output path by dragging the output file to the 
command line when the item it is replacing is the last one in the command, but 
how do I do it for an item in the middle of the command?

Also, when I entered the above text in Terminal to try it out, I got the error 
message "zsh: command not found: $". 

David

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/C5AD7034-128B-4D1E-BF65-971A06CE6861%40earthlink.net.


Re: Help with a GREP task

2022-07-03 Thread Rod Buchanan
On Jun 29, 2022, at 10:22 PM, David Brostoff  wrote:


> On Jun 29, 2022, at 7:43 PM, David Kelly  wrote:
>> 
>> In terminal.app it would be something like this:
>> 
>> awk ‘{ print $1 >> “col-1.txt”
>> print $2 >> “col-2.txt” }’ input.txt
> 
> As I mentioned, I am completely ignorant of awk, so sorry for the basic 
> question, but how do I get Terminal to point to the source document?

(Sorry for being late to the party, just back from a road trip).

Another command-line option would be to use cut.  Assuming the fields are 
separated by a space:

$ cut -d ' ' -f1 source_file.txt > output_file_1.txt
$ cut -d ' ' -f2 source_file.txt > output_file_1.txt

Where:

-d ‘ ‘  Tells cut the fields are separated by a space
-f 1Specifieds the field, in this case 
field 1
source_file.txt the name of the file containing the data
output_file_1.txt   the name of the file you want the output placed 
in

If the fields are separated by TAB, place the cursor between the '' (make sure 
there is no space) and type Ctrl-V, then TAB.

-- 
Rod

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/B4253361-28F7-4EA9-AB4F-B62E207B5B5A%40sofstats.com.


Re: Help with a GREP task

2022-07-03 Thread David Brostoff
On Jul 3, 2022, at 7:26 AM, David Kelly  wrote:
> 
> Create an awk script file. Lets call it "script.awk" that looks like this:
> 
>   {
>   print $1 >> "col-1.txt"
>   print $2 >> "col-2.txt"
>   }

Is creating an awk script file different from entering the above script in 
Terminal?

If not, do I add "awk" before the leading curly bracket?

Thank you,

David

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/20B61565-C771-4A19-8CE7-834946CDC792%40earthlink.net.


Re: Help with a GREP task

2022-07-03 Thread David Brostoff
On Jul 3, 2022, at 12:07 AM, Chris  wrote:
> 
> 
>> On Jul 2, 2022, at 10:55 PM, David Brostoff  wrote:
>> 
>> }’ input.txt/Users/davidbrostoff/Desktop/Sample2010-2011.txt
> 
> You need to replace ‘input.txt’ with the file you are dragging in 
> ‘/Users/davidbrostoff/Desktop/Sample2010-2011.txt’, as ‘input.txt‘was just a 
> stand in for the file you’re working with. 

I had tried that but it still didn't work -- thanks anyway.

David

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/EB419B57-5802-455D-AB96-9EAFE353CA46%40earthlink.net.


Re: Help with a GREP task

2022-07-03 Thread David Kelly



On Jul 3, 2022, at 12:52 AM, David Brostoff  wrote:

> On Jul 2, 2022, at 9:29 PM, David Kelly  wrote:
>> 
>> Type the command line and rather than type the input file name just drag the 
>> file to the command line. Finder/Terminal will write the file's full path on 
>> the command line.
> 
> Thanks for the tip, but I must be doing something wrong. 
> 
> First I copy and paste this command:
> 
> awk ‘{ print $1 >> “col-1.txt”
> print $2 >> “col-2.txt” }’ input.txt
> 
> Then I drag the source file to the command line and press Enter, which 
> produces this error message:
> 
> awk: syntax error at source line 1   
> context is
>>>> ? <<< 
>   missing }
> awk: bailing out at source line 1
> 
> Two text files are produced, but the one named "col-1.txt" is blank and the 
> "col-2.txt" has this line, repeated three times: 
> 
> }’ input.txt/Users/davidbrostoff/Desktop/Sample2010-2011.txt

Sorry about previously not testing it myself and trying to lead you down a 
problematic path of bundling the awk script on a split command line. Some 
things work in bash that don't work in csh or zsh. 

This works no matter what shell:

Create an awk script file. Lets call it "script.awk" that looks like this:

{
print $1 >> "col-1.txt"
print $2 >> "col-2.txt"
}

If memory serves the leading tabs may not be necessary, but the above is 
tested. The tab before first { is where one puts the line-match grep pattern 
but in awk a blank matches all lines. For instance you could make the script 
only split lines that contain numeric digits.

Then type "awk -f script.awk " with a trailing space then drag your file to the 
command line.

Might want to delete or rename previous col-[12].txt because each invocation 
will add new contents to existing files. If you run the script twice you will 
get the 2nd run appended to the first.

--
David Kelly N4HHE, dke...@hiwaay.net

Whom computers would destroy, they must first drive mad.

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/C5D6842A-7126-4858-B336-B3BD65DF255A%40hiwaay.net.


Re: Help with a GREP task

2022-07-03 Thread Chris


> On Jul 2, 2022, at 10:55 PM, David Brostoff  wrote:
> 
> }’ input.txt/Users/davidbrostoff/Desktop/Sample2010-2011.txt

You need to replace ‘input.txt’ with the file you are dragging in 
‘/Users/davidbrostoff/Desktop/Sample2010-2011.txt’, as ‘input.txt‘was just a 
stand in for the file you’re working with. 

--Chris(topher)?

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/1FFD4425-1D67-40D3-88F5-AC9EED28D782%40rustydogink.com.


Re: Help with a GREP task

2022-07-02 Thread David Brostoff
On Jul 2, 2022, at 9:29 PM, David Kelly  wrote:
> 
> Type the command line and rather than type the input file name just drag the 
> file to the command line. Finder/Terminal will write the file's full path on 
> the command line.

P.S. When I said the following line is repeated three times, I now realize 
that's only because I made three attempts:

}’ input.txt/Users/davidbrostoff/Desktop/Sample2010-2011.txt

David 


-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/C395D667-239C-4696-B06A-E537E630F384%40EARTHLINK.NET.


Re: Help with a GREP task

2022-07-02 Thread David Brostoff
On Jul 2, 2022, at 9:29 PM, David Kelly  wrote:
> 
> Type the command line and rather than type the input file name just drag the 
> file to the command line. Finder/Terminal will write the file's full path on 
> the command line.

Thanks for the tip, but I must be doing something wrong. 

First I copy and paste this command:

awk ‘{ print $1 >> “col-1.txt”
print $2 >> “col-2.txt” }’ input.txt

Then I drag the source file to the command line and press Enter, which produces 
this error message:

awk: syntax error at source line 1   
 context is
 >>> ? <<< 
missing }
awk: bailing out at source line 1

Two text files are produced, but the one named "col-1.txt" is blank and the 
"col-2.txt" has this line, repeated three times: 

}’ input.txt/Users/davidbrostoff/Desktop/Sample2010-2011.txt

David 


-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/B7BB1454-4A0D-451D-AADB-B95104629ECB%40earthlink.net.


Re: Help with a GREP task

2022-07-02 Thread David Kelly



On Jul 2, 2022, at 9:26 PM, David Brostoff  wrote:

> On Jun 29, 2022, at 8:49 PM, Christopher Waterman  
> wrote:
>> 
>> It breaks down like this:
>> 
>> awk = The command; it takes two parameters. Param 1: The script. Param 2: A 
>> Path to the source file.
> 
> Again sorry for the beginner question, but what format should I use for the 
> path if, for example, the file is on my Desktop?

Type the command line and rather than type the input file name just drag the 
file to the command line. Finder/Terminal will write the file's full path on 
the command line.

By default Terminal's current directory is your home directory, abbreviated ~ 
so that is where awk will write the output.

--
David Kelly N4HHE, dke...@hiwaay.net

Whom computers would destroy, they must first drive mad.

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/F04FF855-B3BE-4AC2-9B54-47038EF9D095%40hiwaay.net.


Re: Help with a GREP task

2022-07-02 Thread David Brostoff
On Jun 29, 2022, at 8:49 PM, Christopher Waterman  wrote:
> 
> It breaks down like this:
> 
> awk = The command; it takes two parameters. Param 1: The script. Param 2: A 
> Path to the source file.

Again sorry for the beginner question, but what format should I use for the 
path if, for example, the file is on my Desktop?

David

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/697FFF7B-3C9C-4220-AFB2-E53D0DB9FEE7%40earthlink.net.


Re: Help with a GREP task

2022-06-30 Thread David Brostoff
On Jun 30, 2022, at 5:47 AM, John E. Connerat  wrote:
> 
> Although this has been solved in numerous ways, there is one more solution 
> that might work if all the data are formatted with exactly three digits 
> followed by a space and two digits. It's something I use all the time with 
> fixed-width column data, and it's particularly quick, especially if you are 
> dealing with a column in the middle of many columns.

Thanks for the tip -- I have done this occasionally in the past and had briefly 
thought about it for this but somehow didn't even try it. 

David

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/DC544743-DBA4-4EAD-A023-9770E6CD821F%40earthlink.net.


Re: Help with a GREP task

2022-06-30 Thread David Brostoff
On Jun 30, 2022, at 2:05 AM, Kaveh  wrote:
> 
> David, Extract is a great feature. Simple but clever. I use it all the time 
> for quickly analysing text I have scraped for example...

Yes -- for the past couple of years I have only been using BBEdit in a very 
limited way and this was the first time I used Extract, but I can see its 
potential.

David

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/CF0B0EDE-8530-4541-B2A7-ECAB871A07AA%40earthlink.net.


Re: Help with a GREP task

2022-06-30 Thread John E. Connerat
Although this has been solved in numerous ways, there is one more solution 
that might work if all the data are formatted with exactly three digits 
followed by a space and two digits. It's something I use all the time with 
fixed-width column data, and it's particularly quick, especially if you are 
dealing with a column in the middle of many columns.

Let me expound upon the example slightly.

123 56
444 28
232 41
413 82
313 43
789 01

With a list like this you can put your cursor at the top left and click. Do 
not select the row. Then, (on the Mac), hold down the shift and the option 
key and click immediately to teh right of the 9 (In 789). Instead of 
highlighting all characters, all rows, you are just highlighting the exact 
18 characters you want for "column 1." You can then copy or cut and do the 
same thing with column 2.

For a PC, I don't know the exact combination, but I would think it work 
similarly with Shift and Alt or something like that.

NOTE: if you have wide lines, and soft-wrap text is turned on and you have 
wrapping line, this won't work since it would give unintended results.

I use this all the time. It's a super-fast way to extract a delimited 
column of text from a bunch of rows without having to write a regex or use 
awk. It's just a way to invoke copy and paste interstitially!

-John



On Thursday, June 30, 2022 at 5:06:09 AM UTC-4 Kaveh wrote:

> David, Extract is a great feature. Simple but clever. I use it all the 
> time for quickly analysing text I have scraped for example...
>
> On Thu, 30 Jun 2022 at 05:18, David Brostoff  wrote:
>
>> On Jun 29, 2022, at 8:52 PM, Christopher Waterman  
>> wrote:
>> > 
>> > Well… No, no more steps.
>>
>> Mystery solved:
>>
>> I somehow had the Regex command highlighted in the Find box. As soon as I 
>> clicked elsewhere to dismiss the highlighting, the extracted text appeared 
>> in the new document.
>>
>> Thanks again -- I really appreciate your help.
>>
>> David
>>
>> -- 
>> This is the BBEdit Talk public discussion group. If you have a feature 
>> request or need technical support, please email "sup...@barebones.com" 
>> rather than posting here. Follow @bbedit on Twitter: <
>> https://twitter.com/bbedit>
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "BBEdit Talk" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to bbedit+un...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/bbedit/6B2A593B-C6C4-4EAE-A75F-5B93CAF26B17%40earthlink.net
>> .
>>
>> -- 
>> This is the BBEdit Talk public discussion group. If you have a feature 
>> request or need technical support, please email "sup...@barebones.com" 
>> rather than posting here. Follow @bbedit on Twitter: <
>> https://twitter.com/bbedit>
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "BBEdit Talk" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to bbedit+un...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/bbedit/A3E920D6-108D-4EBB-988E-023C8C948DAD%40EARTHLINK.NET
>> .
>>
>
>
> -- 
> Kaveh Bazargan PhD
> Director
> River Valley Technologies  ● Twitter 
>  ● LinkedIn 
>  ● ORCID 
> 
> *Accelerating the Communication of Research*
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/b451eb4b-6ac1-4a3e-94df-9107bf9d3e29n%40googlegroups.com.


Re: Help with a GREP task

2022-06-30 Thread Kaveh
David, Extract is a great feature. Simple but clever. I use it all the time
for quickly analysing text I have scraped for example...

On Thu, 30 Jun 2022 at 05:18, David Brostoff  wrote:

> On Jun 29, 2022, at 8:52 PM, Christopher Waterman 
> wrote:
> >
> > Well… No, no more steps.
>
> Mystery solved:
>
> I somehow had the Regex command highlighted in the Find box. As soon as I
> clicked elsewhere to dismiss the highlighting, the extracted text appeared
> in the new document.
>
> Thanks again -- I really appreciate your help.
>
> David
>
> --
> This is the BBEdit Talk public discussion group. If you have a feature
> request or need technical support, please email "supp...@barebones.com"
> rather than posting here. Follow @bbedit on Twitter: <
> https://twitter.com/bbedit>
> ---
> You received this message because you are subscribed to the Google Groups
> "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to bbedit+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/bbedit/6B2A593B-C6C4-4EAE-A75F-5B93CAF26B17%40earthlink.net
> .
>
> --
> This is the BBEdit Talk public discussion group. If you have a feature
> request or need technical support, please email "supp...@barebones.com"
> rather than posting here. Follow @bbedit on Twitter: <
> https://twitter.com/bbedit>
> ---
> You received this message because you are subscribed to the Google Groups
> "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to bbedit+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/bbedit/A3E920D6-108D-4EBB-988E-023C8C948DAD%40EARTHLINK.NET
> .
>


-- 
Kaveh Bazargan PhD
Director
River Valley Technologies  ● Twitter
 ● LinkedIn
 ● ORCID

*Accelerating the Communication of Research*

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/CAJ2R9pjxcHmFk7ObmWNpXy3GT42HWNVnSN4CO88c8EuMmtxHxw%40mail.gmail.com.


Re: Help with a GREP task

2022-06-29 Thread David Brostoff
On Jun 29, 2022, at 8:52 PM, Christopher Waterman  wrote:
> 
> Well… No, no more steps.

Mystery solved:

I somehow had the Regex command highlighted in the Find box. As soon as I 
clicked elsewhere to dismiss the highlighting, the extracted text appeared in 
the new document.

Thanks again -- I really appreciate your help.

David

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/6B2A593B-C6C4-4EAE-A75F-5B93CAF26B17%40earthlink.net.

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/A3E920D6-108D-4EBB-988E-023C8C948DAD%40EARTHLINK.NET.


Re: Help with a GREP task

2022-06-29 Thread David Brostoff
On Jun 29, 2022, at 8:52 PM, Christopher Waterman  wrote:
> 
> Well… No, no more steps.

Is it because I am using BBEdit in free mode?

David

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/6B2A593B-C6C4-4EAE-A75F-5B93CAF26B17%40earthlink.net.


Re: Help with a GREP task

2022-06-29 Thread David Brostoff
On Jun 29, 2022, at 8:49 PM, Christopher Waterman  wrote:
> 
> Does that help?

Yes, now I get it -- thank you.

David

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/C9C43415-D059-4644-849B-810D062F8D8E%40earthlink.net.


Re: Help with a GREP task

2022-06-29 Thread Christopher Waterman
Well… No, no more steps.

If it highlights it should work. If it doesn’t find a match it should just beep 
without opening a new document.

I’m flummoxed. 路‍♂️
Maybe if I could see the full doc I could figure out what is happening.

— Chris(topher)?


> On Jun 29, 2022, at 8:18 PM, David Brostoff  wrote:
> 
> On Jun 29, 2022, at 7:58 PM, Christopher Waterman  
> wrote:
>> 
>> It is pretty easy to do this with two finds with extract.
>> Extract opens the matches in a new document.
>> 
>> Find: ^\d{3}
>> Then hit extract
>> 
>> Find: \b\d{2}\b
>> Then hit extract again
> 
> Thank you for the easy-to-follow instructions.
> 
> When I click extract, it highlights the matches and opens a new document but 
> it's blank?
> 
> Is there another step?
> 
> David
> 
> 
> -- 
> This is the BBEdit Talk public discussion group. If you have a feature 
> request or need technical support, please email "supp...@barebones.com" 
> rather than posting here. Follow @bbedit on Twitter: 
> 
> --- 
> You received this message because you are subscribed to the Google Groups 
> "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to bbedit+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/bbedit/555CFE8B-8E9A-48D4-B2C9-444F86E3FABB%40earthlink.net.

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/96095F7E-B0FC-4B39-9865-75F9FA65EB87%40rustydogink.com.


Re: Help with a GREP task

2022-06-29 Thread Christopher Waterman
It breaks down like this:

awk = The command; it takes two parameters. Param 1: The script. Param 2: A 
Path to the source file.

‘{ print $1 >> “col-1.txt”
print $2 >> “col-2.txt” }’ = The Script, everything between the single quotes.

This script is printing or saving column 1 ($1) to a file called col-1.txt and 
column 2 ($2) to col-2.txt.

input.txt = Source file

Does that help?

> On Jun 29, 2022, at 8:22 PM, David Brostoff  wrote:
> 
> On Jun 29, 2022, at 7:43 PM, David Kelly  wrote:
>> 
>> In terminal.app it would be something like this:
>> 
>> awk ‘{ print $1 >> “col-1.txt”
>> print $2 >> “col-2.txt” }’ input.txt
> 
> As I mentioned, I am completely ignorant of awk, so sorry for the basic 
> question, but how do I get Terminal to point to the source document?
> 
> David
> 
> -- 
> This is the BBEdit Talk public discussion group. If you have a feature 
> request or need technical support, please email "supp...@barebones.com" 
> rather than posting here. Follow @bbedit on Twitter: 
> 
> --- 
> You received this message because you are subscribed to the Google Groups 
> "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to bbedit+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/bbedit/F3146D85-3A4B-4D8A-9F49-B12324BA3951%40earthlink.net.
> 
> -- 
> This is the BBEdit Talk public discussion group. If you have a feature 
> request or need technical support, please email "supp...@barebones.com" 
> rather than posting here. Follow @bbedit on Twitter: 
> 
> --- 
> You received this message because you are subscribed to the Google Groups 
> "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to bbedit+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/bbedit/A58A9E81-D6F0-4751-AC2D-03D95C4E15F6%40earthlink.net.

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/8079C83F-5BAC-4CDC-8E27-E06F0BE46F27%40rustydogink.com.


Re: Help with a GREP task

2022-06-29 Thread David Brostoff
On Jun 29, 2022, at 7:43 PM, David Kelly  wrote:
> 
> In terminal.app it would be something like this:
> 
> awk ‘{ print $1 >> “col-1.txt”
>  print $2 >> “col-2.txt” }’ input.txt

As I mentioned, I am completely ignorant of awk, so sorry for the basic 
question, but how do I get Terminal to point to the source document?

David

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/F3146D85-3A4B-4D8A-9F49-B12324BA3951%40earthlink.net.

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/A58A9E81-D6F0-4751-AC2D-03D95C4E15F6%40earthlink.net.


Re: Help with a GREP task

2022-06-29 Thread David Brostoff
On Jun 29, 2022, at 7:58 PM, Christopher Waterman  wrote:
> 
> It is pretty easy to do this with two finds with extract.
> Extract opens the matches in a new document.
> 
> Find: ^\d{3}
> Then hit extract
> 
> Find: \b\d{2}\b
> Then hit extract again

Thank you for the easy-to-follow instructions.

When I click extract, it highlights the matches and opens a new document but 
it's blank?

Is there another step?

David


-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/555CFE8B-8E9A-48D4-B2C9-444F86E3FABB%40earthlink.net.


Re: Help with a GREP task

2022-06-29 Thread David Brostoff
On Jun 29, 2022, at 7:43 PM, David Kelly  wrote:
> 
> In terminal.app it would be something like this:
> 
> awk ‘{ print $1 >> “col-1.txt”
>   print $2 >> “col-2.txt” }’ input.txt

Thank you -- I haven't used awk before though so I will have to get up to 
speed. (I asked about GREP only because I have used it a little in the past.)

David

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/F3146D85-3A4B-4D8A-9F49-B12324BA3951%40earthlink.net.


Re: Help with a GREP task

2022-06-29 Thread David Kelly


On Jun 29, 2022, at 8:59 PM, David Brostoff  wrote:

> I have a list of numbers in this format:
> 
> 123 56
> 789 01
> 
> How can I create two separate documents with 123 and 789 in one and 56 and 01 
> in the other?

I don’t think that is a good grep task. It cries for awk.

In terminal.app it would be something like this:

awk ‘{ print $1 >> “col-1.txt”
   print $2 >> “col-2.txt” }’ input.txt

Anyway, that is the idea. My awk is rusty.

--
David Kelly N4HHE, dke...@hiwaay.net

Whom computers would destroy, they must first drive mad.

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/7450BB2E-FBB8-4A30-B60B-6CCC6508CD68%40hiwaay.net.