Thanks everyone, got this working.

*awk -v LIMIT=$UGIDLIMIT -F':' '($3>=LIMIT) && ($3!=65534) && ($6=="/sftp")' 
/etc/passwd > /home/ 
xxxxxxxx /migrate/passwd.mig*

On Saturday, 6 March 2021 at 12:18:16 UTC danish09 wrote:

> Hi,
>
> ansible 2.4.0
> remote environment: ubuntu 14.04
> host/controller: Ubuntu 16.04.7 LTS
>
> I have a task to extract some usernames from the passwd file
>
> *- name: extract usernames from password file *
>
> *  shell: "awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534) && 
> ($6="/sftp")' /etc/passwd > /home/xxxxxxxx/migrate/passwd.mig"*
>
> However, I am not sure why ansible is complaining when I run the above 
> command.
>
> When I run the awk command on the server CLI it runs fine. I have even 
> tried escaping "/sftp" with a \\ but then awk complains so not sure how to 
> g about it.
>
> Thanks 
>
> Danish
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/228c9869-3be7-477e-a158-f233546f979en%40googlegroups.com.

Reply via email to