The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
The cut command. Really simple question! rorey_breaker Shell Programming and Scripting 1 08-26-2007 09:08 AM
head command sumesh.abraham Shell Programming and Scripting 6 02-23-2007 07:21 AM
simple 'head' question terms5 UNIX for Dummies Questions & Answers 3 02-16-2006 09:31 PM
SImple command question Diabeticus UNIX for Dummies Questions & Answers 4 02-08-2002 06:43 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 04-23-2006
Registered User
 

Join Date: Apr 2006
Posts: 5
Simple Command (head) Question

Okay, this probably sounds dumb for anyone who knows the answer, but I'm completely lost. I have to use the head command to search a directory AND all of its subdirectories to display the first line of all .txt files. I know how to do this: head -1 ~/UnixCourse/*.txt, but that does not search the subdirectories. I've tried to figure it out on my own and use help resources, but had no luck. I would really appreciate if someone could save me a little time and effort by helping me out here.
Reply With Quote
Forum Sponsor
  #2  
Old 04-23-2006
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,003
look into 'man find'
Reply With Quote
  #3  
Old 04-23-2006
Registered User
 

Join Date: Apr 2006
Posts: 5
I've looked into find and understand how to make that work with subdirectories, but I have not seen any way to use it with the "head" command. Am I missing something or was I just not clear that I need to use the head command to get the first lines of each file?
Reply With Quote
  #4  
Old 04-23-2006
zazzybob's Avatar
Registered Geek
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
Look at the -exec part of the man page....

Cheers
ZB
Reply With Quote
  #5  
Old 04-23-2006
Registered User
 

Join Date: Apr 2006
Posts: 5
Ahh got it now, thanks I had tried it once before but did not use the {}'s correctly so could not figure it out. Thanks again for the help!
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 10:39 AM.


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