简体   繁体   中英

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 -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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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