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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

selective delete of lines in a file

Status
Not open for further replies.

alan147

Technical User
Nov 15, 2002
128
GB
Good morning

I need to be able to extract from a directory list (ls -al) firstly all the non directory files and secondly all the directories. Is there a way to do this?

Thanks

Alan
 
# gets all dirs
ls -al | awk '/^d/'

# gets all files
ls -al | awk '/^-/'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top