本文介绍了基本awk程序失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我试图让一所学校分配的awk程序。我刚刚开始,所以我想编写程序本身之前,我会练习一点点。这是我的做法的程序:

So, I'm trying to make an awk program for a school assignment. I've just started, so I thought before writing the program itself, I would practice a little bit. This is my practice program:

BEGIN {print "yo"}

我试图用这个命令运行它:

I try to run it with this command:

awk -f awk1 sample

在哪里样本只是包含一些记录,我要处理(实际转让)的文本文件,并在电脑只是说这样的:

Where sample is just a text file containing some records that I want to process (for the actual assignment), and the computer just says this:

awk: syntax error near line 1
awk: bailing out near line 1

我觉得这样彻底,令人难以置信的愚蠢,但我究竟做错了什么?据我所知,似乎没有什么是错误的程序!

I feel so utterly and incredibly dumb, but what am I doing wrong? As far as I can tell, nothing seems to be wrong with the program!

推荐答案

您使用的是旧的,破的awk(在/ usr / bin /在AWK的Solaris)。我可以告诉大家,因为这毫无用处错误消息。在Solaris上使用/ usr / XPG4 /斌/ AWK或NAWK或安装/使用GAWK。从来没有,每一个使用旧的,破的awk,因为它是很好,破烂不堪。

You are using old, broken awk (/usr/bin/awk on Solaris). I can tell because of that useless error message. On Solaris use /usr/xpg4/bin/awk or nawk or install/use gawk. Never, every use old, broken awk as it is, well, old and broken.

这篇关于基本awk程序失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 16:28