简体   繁体   English

为什么我的 linux 命令与 awk 不起作用

[英]Why is my linux command with awk not working

i am trying to let this command work but it won't let me do anything我试图让这个命令工作,但它不会让我做任何事情

awk -F: ‘{if($3>'1000') print$1}’ passwd | sort > users.txt

I get an error which is saying:我收到一条错误消息:

bash: syntaxfout nabij onverwacht symbool '('

Can someone help me out?有人可以帮我吗?

You're using ' instead of ' .您正在使用'而不是' And then, you should replace ' with " in the awk program (or just leave them out):然后,您应该在 awk 程序中将'替换为" (或将它们排除在外):

awk -F: '{if ($3 > 1000) print $1}' passw | ...

You're using backticks instead of single quotes.您使用的是反引号而不是单引号。 Try:尝试:

awk -F: '{if($3>1000) print $1} passwd | sort > users.txt

or just要不就

awk -F: '$3>1000 {print $1}' passwd | sort > users.txt

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM