On Jul 3, 2022, at 1:43 PM, David Brostoff <dav...@earthlink.net> wrote:

> On Jul 3, 2022, at 7:26 AM, David Kelly <dke...@hiwaay.net> 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: <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/4396EBB4-B040-4842-8D98-C87E502DB10E%40hiwaay.net.

Reply via email to