Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • 1
    why use < file when awk already has the ability to open file? Commented Apr 17, 2022 at 10:52
  • 1
    @phuclv some people like seeing the name of the file first on the command line so this is better than cat file | awk... for those people and it allows the shell to open the file instead of the command so you get consistent file-opening-failure error messages if you use that idiom for all commands (including those like tr that can't open a file themselves) and on a file opening failure < file awk '...' > output won't create output create an empty (or overwrite if it exists) file named output . The downside is you can't do that for opening multiple files and you lose FILENAME access. Commented Apr 17, 2022 at 12:00