Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Is there any way to run bash commands from within awk?
I want to use 'read' command inside awk but it's not working. Is there any workaround?
{}
system()
awk
getline
awk 'BEGIN{"ls" |& getline a;print a}'
# gawk 'BEGIN {system("touch /tmp/aaaa")}' # ls /tmp/aaaa /tmp/aaaa
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
{}doing the same, alsosystem()can run commandawk's owngetlinehelp? Or are you trying to do something interactive?awk 'BEGIN{"ls" |& getline a;print a}'