0

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

1 Answer 1

2
$ 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
Sign up to request clarification or add additional context in comments.

1 Comment

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?

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.