I have an awk script that processes files passed in. It runs on one input file and redirects into one output file...
awk -f solar.awk ./PerformanceData_2023-08-02_02-02-17/tmp_YdayData.txt > output.txt
... however, passing multiple files does not work.
For example passing in two files like so:
awk -f solar.awk ./PerformanceData_2023-08-02_02-02-17/tmp_YdayData.txt ./PerformanceData_2023-08-01_02-02-17/tmp_YdayData.txt
... only processes the first file (not the second): No idea why.
However, what I'd like to ultimately achieve is finding files in sub directories and run the awk command against it, collecting the results in one output file.
find . -type f -name 'tmp_YdayData.txt' -print0 | xargs -0 -t awk -f solar.awk >> output.txt
While this finds the relevant files (if I run the command portion before the pipe) the full command line, however, it only processes the first file.
find . -type f -name 'tmp_YdayData.txt' -print0 | xargs -0 -t awk -f /home/maxg/Workspaces/awk/solar/solar.awk
awk -f /home/maxg/Workspaces/awk/solar/solar.awk ./PerformanceData_2023-08-01_02-02-17/tmp_YdayData.txt ./PerformanceData_2023-08-02_02-02-17/tmp_YdayData.txt ./PerformanceData_2023-08-03_02-02-17/tmp_YdayData.txt ./PerformanceData_2023-08-04_02-02-18/tmp_YdayData.txt ./PerformanceData_2023-08-05_02-02-37/tmp_YdayData.txt ./PerformanceData_2023-08-06_02-02-18/tmp_YdayData.txt
01/08/2023, 66.03, 25.59, 36.25, 12.81, 0.41, 17.30, -0.10, 22.2, 100.0, 10:55
What am I doing wrong?
I have not provided the awk script, as reducing its content to print $0 generates the same result.
I have since posted the solution, as my command line arguments where incorrect.
Well, after lots of fiddling, the following command does what I want:
I changed the command line from
xargstoexec.