Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How check if it is direcory in awk

Status
Not open for further replies.

omasnjak

Technical User
Jun 1, 2008
13
CZ
Hi people,

I know I read it in some book, but I cannot find it at moment.
Let say I have in some directory and some files and directorie s in that directory.
How using awk to check if it is directory in that directory ( can you follow :) ) or just perform some actions on directories, and not on regular files.
Thank you in advance.

Regards.
 
You could use the -type d expression to find to check for a directory and then call your awk if it is.

I want to be good, is that not enough?
 
Don't think you can, from awk. But you can from bash or perl. Maybe you should try another language?

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::perlDesignPatterns)[/small]
 
yes it is possible in awk, but I can not find how to do that ...but something awk -p|qppqwvd something ...but it is possible. I will try to find it and post it here ,but I need it very fast....
 
You could read in the output of ls -l and check for 'd's on the beginnings of the lines.

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top