Looking for hidden files:
$ find . -type f -not -name "."
./.kjj.jpg
./2.jpg.~1~
Now, using the same commands, but inside awk:
$ awk 'BEGIN{ system(find . -type f -not -name ".") }'
awk: 1: unexpected character '.'
Why does it not work?
Martin G
18.4k12 gold badges91 silver badges105 bronze badges
asked Apr 10, 2012 at 5:27
Tedee12345
1,3824 gold badges17 silver badges26 bronze badges
1 Answer 1
$ awk 'BEGIN{ system("find . -type f -not -name \".\"") }'
The system() function accepts a string; find . -type... withut quotes is simply invalid AWK syntax.
answered Apr 10, 2012 at 5:29
Amadan
200k23 gold badges252 silver badges321 bronze badges
Sign up to request clarification or add additional context in comments.
1 Comment
Nahid Bandi
I had the same problem and it seems it would help me. I have asked question here:unix.stackexchange.com/questions/446253/…. but now my problem is that how can I pass the directory as a variable to find command?? can you help me with that?