I have a file:
AA
BB
This command prints:
$ awk '{ORS=""; printf "%s ", $0 } END {print "\n"}' file
AA BB
I want to use these commands, but the function:
The first function:
awk 'function my() { system("echo | awk '{ ORS=""; printf "%s ", $0 } END {print "\n"}' file") } BEGIN { my() }'
The second function:
awk 'function my() { system("cat file") } BEGIN { my() }'
I want to print the result:
AA BB
Thank you for your help.
EDIT:
I want to use system(command) in my() function.
awk 'function my() { system(Here I want to insert proper command) } BEGIN { my() }' -> to print the result:
AA BB
It is possible to print the result by nesting awk command?
Thanks for any proposed solution.
No comments:
Post a Comment