I am using gawk5 at the Windows 10 command prompt.
There are 10 files from ss1.txt to ss10.txt, and 10 corresponding awk programs from fff1.awk to fff10.awk.
If you run them in a batch file, you get 10 lines.
gawk-b-ffff1.awkss1.txt
gawk-b-ffff2.awkss2.txt
gawk-b-ffffff3.awkss3.txt
↓ (Interim Omission)
gawk-b-ffff10.awkss10.txt
I wanted to summarize this compactly, so I created the test.awk below, but I think it is slow and inefficient because I start the child gawk with the system function from gawk.
test.awk
BEGIN{
for (i=1; i<=10;i++)
{
cmd = "gawk-b-ffff "i".awk "ss "i".txt"
system(cmd)
close(cmd)
}
}
I can't create a system function or a method that doesn't double-start gawk.
Please advise me on a good way.Please.
If it's a batch file,
FOR/L%IIN (1,1,10) DO gawk-b-ffff%I.awkss%I.txt
PowerShell
for($i=1;$i-le10;$i++){
gawk-b-ffffff$i.awkss$i.txt
}
Is that so?
Essentially, it is recommended to consolidate awk programs into one or switch to a different language.
If a WSL2 environment is available instead of a command prompt:If you are interested, please try it.
$seq10|xargs-P0-I@[email protected]@.txt
© 2024 OneMinuteCode. All rights reserved.