I write now an AWK function, that should look like:
function inser_styles(path_to_files, output_file) {
for each input_file in path_to_files {
print "" > output_file;
while ( getline < input_file ) {
print " " $0 > output_file;
}
}
print "" > output_file;
}
It shoud read files from some path_to_files directory and put all the content of each input_file into some output_file, separated with empty line.
How could the for each input_file in path_to_files {...} – loop look like? Does the awk support this kind of for-loop or should I read the filename array with extern execute of ls?
You can use the
findutility to get the filenames. Note that this will not work properly if filenames contain newlines. Specify any additional options that you’d like to use withfind.