How are you going to use this? Do you plan to use it as a command line script? In this case, you need to pack it as follows hello world question .
Or do you plan to use it interactively, in which case you probably want to get the result in a new buffer ...
This code gets the basics. You will need to update it to fit your usage model.
(defun awk (filename &rest cols)
"Given a filename and at least once column, print out the column(s) values
in the order in which the columns are specified."
(let* ((buf (find-file-noselect filename)))
(with-current-buffer buf
(while (< (point) (point-max))
(let ((things (split-string (buffer-substring (line-beginning-position) (line-end-position))))
(c cols)
comma)
(while c
(if comma
(print ", "))
(print (nth (1- (car c)) things))
(setq comma t)
(setq c (cdr c)))
(print "\n")
(forward-line))))
(kill-buffer buf)))