I need to extract the email (column 3) and send a mail to each person, with their details ( specifically username and password.). so for eg 100 emails for 100 lines
I think this should be possible using awk and mailx but I am not able to get it to work
'sh' is shell (usually /bin/sh, which is usually a symbolic link to bash, dash, ksh or other shell).
So by piping a command to shell, it gets executed. Simple like that.
E.g.:
$ echo cat /etc/passwd
cat /etc/passwd
$ echo cat /etc/passwd | sh #same as invoking 'cat /etc/passwd' directly
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
....
It is the same as calling the argument of echo in command line; that echoing makes debugging easy though, and will echo the command to the stdout before you are ready to execute it