how to add ' using awk

hi all

I would like to find out how to add ' using awk. I have used the \ to hide the special character but still not successful.

The error stated,
Syntax error at line 1 : `"' is not matched.

My command is,
awk '{print "\'", $1 ;}' lotnums.txt > 1.txt

Pls advise.

echo "test" | awk -v v="'" '{ print v $1 v; }'

Output:
'test'

Hi

Is there any reason why \' does not work in awk whereas \" is able to be accepted?

Pls advise. Thanks

Because the shell is getting in the way and thinks the ' is the end of the awk program.

Check this tricky variant:

echo "test" | awk  '{ print "'\''"$1"'\''"}'
# awk 'BEGIN{print "\047"}'
'