I have a file with things like serialno, userid and password. When fetching column 3 using awk, a problem crops up for user id jij because of the "*" in the password. How to retrieve the password properly?.
cat testfile
1 abc bnmj134
2 fff u7Tdff
3 jij Qm6Pn*w
a=grep jij testfile|awk '{print $3}'
echo $a does not output, showing error as echo : No match.
The problem is with echo, not awk. Use double quotes. echo “$a”
– HelloWorld Oct 28 '21 at 03:44echo $variableshows something else" and many similar questions. – Gordon Davisson Oct 28 '21 at 03:57shoptbuilt-in shell function – PersianGulf Oct 28 '21 at 04:08set -f, notshoptanything. And disabling globbing globally is a rather big hammer to use. Disabling the error from a non-matching glob isshopt -u failglobin Bash though, but letting it glob in the first place is still wrong. – ilkkachu Oct 28 '21 at 05:45bash: no match: Qm6Pn*w(iffailglobis set, which it isn't by default), zsh would sayzsh: no matches found: Qm6Pn*wand (t)csh saysecho: No match.. Other than the extra space, your error looks like tcsh, but you tagged this with [[tag:bash]], so you may want to check what shell you're running. – ilkkachu Oct 28 '21 at 05:47