Skip to main content
deleted 29 characters in body
Source Link
Chris
  • 1k
  • 11
  • 22

Is there a way to put little awk scriptoids on the path?

For example, I have this really useful collation operation:

// collate-csv.awk
NRFNR ==> 1 { print|| }
FNRNR == 1 { next } 
{print} 

And I can use it in all sorts of great ways:

xargs -a $(find * -name *.csv) awk -F',' -f collate-csv.awk | ...

The only problem is I don't have a way to call my awk tools from anywhere. With an executable shell script, I can drop it into a bin folder on the path. Is there a mechanism in linux where I can make these non-executable awk source files available from anywhere I go in the filesystem?

(with the qualification that the "mechanism" is not a "why don't you just hit it with a hammer"-style kludge)

Is there a way to put little awk scriptoids on the path?

For example, I have this really useful collation operation:

// collate-csv.awk
NR == 1 { print }
FNR == 1 { next } 
{print} 

And I can use it in all sorts of great ways:

xargs -a $(find * -name *.csv) awk -F',' -f collate-csv.awk | ...

The only problem is I don't have a way to call my awk tools from anywhere. With an executable shell script, I can drop it into a bin folder on the path. Is there a mechanism in linux where I can make these non-executable awk source files available from anywhere I go in the filesystem?

(with the qualification that the "mechanism" is not a "why don't you just hit it with a hammer"-style kludge)

Is there a way to put little awk scriptoids on the path?

For example, I have this really useful collation operation:

// collate-csv.awk
FNR > 1 || NR == 1

And I can use it in all sorts of great ways:

xargs -a $(find * -name *.csv) awk -F',' -f collate-csv.awk | ...

The only problem is I don't have a way to call my awk tools from anywhere. With an executable shell script, I can drop it into a bin folder on the path. Is there a mechanism in linux where I can make these non-executable awk source files available from anywhere I go in the filesystem?

(with the qualification that the "mechanism" is not a "why don't you just hit it with a hammer"-style kludge)

Became Hot Network Question
Source Link
Chris
  • 1k
  • 11
  • 22

Awk: Scripts on the path?

Is there a way to put little awk scriptoids on the path?

For example, I have this really useful collation operation:

// collate-csv.awk
NR == 1 { print }
FNR == 1 { next } 
{print} 

And I can use it in all sorts of great ways:

xargs -a $(find * -name *.csv) awk -F',' -f collate-csv.awk | ...

The only problem is I don't have a way to call my awk tools from anywhere. With an executable shell script, I can drop it into a bin folder on the path. Is there a mechanism in linux where I can make these non-executable awk source files available from anywhere I go in the filesystem?

(with the qualification that the "mechanism" is not a "why don't you just hit it with a hammer"-style kludge)