The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
moving directories to new directories on multiple servers mackdaddy07 Shell Programming and Scripting 0 04-06-2007 08:30 AM
How to backup /home directories? kingsan SUN Solaris 1 05-03-2006 02:41 PM
Delete old home directories munch UNIX for Dummies Questions & Answers 2 03-01-2006 10:16 PM
HACMP users home directories zz2kzq AIX 1 02-21-2006 12:22 PM
home network not working! boris888 IP Networking 2 05-14-2002 07:10 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #8  
Old 05-15-2008
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,298
Code:
find . -type d
lists all directories as well.
Reply With Quote
Forum Sponsor
  #9  
Old 05-15-2008
Registered User
 

Join Date: May 2008
Posts: 33
Quote:
Originally Posted by jim mcnamara View Post
Code:
find . -type d
lists all directories as well.
it does but it lists all directories recursivly which I did not want. I was just looking for directories in the current directory

penchal,

I changed your line a bit awk can parse, whatever it is called, the ^d so grep is not needed.

ls -ltr | awk '/^d/ {print $NF}'

Im still reading up on awk to figure out what exactly the $NF does though
Reply With Quote
  #10  
Old 05-15-2008
Registered User
 

Join Date: May 2008
Posts: 33
ok, $NF is just a variable for the number of fields in the file.. so whenI call it it just automagically calls the last field to be printed? Is that correct?
Reply With Quote
  #11  
Old 05-15-2008
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,298
Yes that is what $NF refers to.
Reply With Quote
  #12  
Old 05-15-2008
Registered User
 

Join Date: May 2008
Posts: 33
awesome, thanks everyone. I didnt realize this scripting stuff wasnt so hard to figure out. I wish I would of jumped on learning this stuff a few years ago
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
solaris

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 12:15 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0