I have an input file called "namelist.txt" with email addresses:
[email protected]
[email protected]
[email protected]
I am trying to read the addresses from this input file and inserting their values into an output file (newfile.txt) that should read:
user "[email protected]" with pass"pass" is "[email protected]" here
user "[email protected]" with pass"pass" is "[email protected]" here
user "[email protected]" with pass"pass" is "[email protected]" here
The closest I have come is by using awk:
awk '{print "user $0 there with pass"pass" is user $0 here"}' < namelist.txt > newfile.txt
This however prints the following:
user $0 there with pass is user $0 here
user $0 there with pass is user $0 here
user $0 there with pass is user $0 here
This doesn't print the variable values nor the "pass" value.
I don't know where I am going wrong or whether I am even on the right track, so any advice and / or pointers would be greatly appreciated.
EDIT:
Using:
awk '{print "user \""$0"\" there with pass \"pass\" is user \""$0"\" here}' file
results in the following output on Ubuntu (14.04.2 LTS):
" heree with pass "pass" is user "[email protected]
" heree with pass "pass" is user "[email protected]
" heree with pass "pass" is user "[email protected]
Abovementioned code works fine in a UNIX terminal but not in Ubuntu nor Raspberry Pi.
I am confused as to why the differences between distros.