[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] gawk deal with file separator

From: Stephane Chazelas
Subject: Re: [bug-gawk] gawk deal with file separator
Date: Fri, 13 Sep 2019 20:15:27 +0100
User-agent: NeoMutt/20171215

2019-09-13 06:11:21 -0500, Peng Yu:
> There are case when I need to do some preprocessing of files, but I want to
> avoid temp file. I could do something like this.
> awk -f file.awk <(process.sh f1.txt) <process f2.txt) <(printf ‘%s\n’
> f{1,2}.txt)
> Note that FILENAME won’t keep original filenames. But I need to know the
> filenames. So I have to pass the filenames in the last ARGV, then I need to
> process it and delete it in BEGIN. All of these are not convenient.

just do:

awk -f file.awk file=f1,txt <(process.sh f1.txt) file=f2.txt <(process.sh 

You could also use env vars referenced in awk as
ENVIRON["FILE"], or ENVIRON["FILE" n] if you have env vars named


reply via email to

[Prev in Thread] Current Thread [Next in Thread]