0

Issue: I'm trying to run an awk script from the terminal and I keep getting

(No such file or directory)

So I've deleted everything but the essentials from the script and it still isn't working. Any ideas?

here is the awk script

#! /usr/bin/awk -f
BEGIN { print "Hello World!"; }

I know this is must be an embarrassingly simple issue, and I apologize!

... also I'm ultimately trying to work with a CSV file, where would I place that file's path in order to work within my script? Thanks!

user7823016
  • 157
  • 2
  • 11
  • What exactly are you typing into the terminal? – Nate Eldredge Sep 22 '19 at 01:21
  • The answers to https://stackoverflow.com/questions/733824/how-to-run-a-shell-script-on-a-unix-console-or-mac-terminal?rq=1 are probably something you should read - most of it (PATH, permissions, etc) applies equally to awk as well as shell. – Nate Eldredge Sep 22 '19 at 01:23
  • @NateEldredge I'm typing `chmod +x lab2.awk` followed by `./lab2.awk` also `#!` is in my script, I just had to type it into here since I couldn't copy and paste from Virtualbox. Apologies for the typo & confusion – user7823016 Sep 22 '19 at 01:24
  • You're sure that `/usr/bin/awk` exists on your system? – Nate Eldredge Sep 22 '19 at 01:26
  • yes, I checked with `which -a awk` and the result was `/usr/bin/awk` – user7823016 Sep 22 '19 at 01:30
  • 1
    (1) Just to make sure, if you run `/usr/bin/awk`, you get help text or something like that? (2) Does `cat lab2.awk` print out the script? (3) What does `ls -l lab2.awk` say? – Nate Eldredge Sep 22 '19 at 01:34
  • 1
    Also, what's the exact complete error message (I bet it doesn't really have parentheses, for one thing)? And is that message issued by `chmod +x lab2.awk` or by `./lab2.awk`? – Nate Eldredge Sep 22 '19 at 01:35
  • Please show the exact command and exact error you are encountering. Copy/paste them from the terminal. Also see [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve). – jww Sep 23 '19 at 00:37

0 Answers0