Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
AWK
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Self-contained AWK scripts == On Unix-like operating systems self-contained AWK scripts can be constructed using the [[shebang (Unix)|shebang]] syntax. For example, a script that sends the content of a given file to standard output may be built by creating a file named <code>print.awk</code> with the following content: <syntaxhighlight lang="awk"> #!/usr/bin/awk -f { print $0 } </syntaxhighlight> It can be invoked with: <code>./print.awk <filename></code> The <code>-f</code> tells awk that the argument that follows is the file to read the AWK program from, which is the same flag that is used in sed. Since they are often used for one-liners, both these programs default to executing a program given as a command-line argument, rather than a separate file.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)