- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- using the find command instead of writing a script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2011 12:43 PM
01-25-2011 12:43 PM
The end result I'm shooting for is use find to extract a list of all dirs/files in each user's home dir and display/list the GID rather than the group name in the listing.
Any ideas?
Thx.
Solved! Go to Solution.
- Tags:
- find
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2011 01:39 PM
01-25-2011 01:39 PM
Solutionfind /home/moe /home/larry /home/curly | xargs ls -ldn
The 'ls -ldn' will do a long listing, not traversing a directory, and will substitute the uid/gid rather than the username and group name. If you just want the file name and gid:
find /home/moe /home/larry /home/curly | xargs ls -ldn | awk '{print $4,$9}'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2011 03:06 PM
01-25-2011 03:06 PM
Re: using the find command instead of writing a script
I might do:
# find /home/moe /home/larry /home/curly -exec ls -ln {} + | awk '{print $3,$4,$NF}'
Using the '+' terminator to find()'s '-exec' argument eliminates the 'xargs' process but creates a very large argument list for every instantiation of the 'ls' process, thereby optimizing performance.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2011 09:49 PM
01-25-2011 09:49 PM
Re: using the find command instead of writing a script
You'll need to add -d so you don't list the directories twice:
... -exec ls -ldn {} + | ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2011 06:32 AM
01-26-2011 06:32 AM
Re: using the find command instead of writing a script
Dennis: You'll need to add -d ...
Yes, of course (dummy me); thanks.
BTW, John: When does a command-line "script" [ which to me is more than one builtin command or external executable ] become a "full script" ? :-) Everything is relative and depends partly on how much you want/can pack onto a command-line.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2011 07:27 AM
01-26-2011 07:27 AM
Re: using the find command instead of writing a script
> which to me is more than one builtin
> command or external executable ] become a
> "full script" ?
Some (perhaps many) would say: When it's in a
file of its own.
Multiple commands on one command line is
often called a "list" or a "pipeline", but
check your shell documentation for the
details.
man sh
man [...]
Sometimes terms like these are actually
defined in the documentation, and while one
is always free to create one's own
definitions, there are advantages to using
standard ones.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2011 11:38 AM
02-01-2011 11:38 AM
Re: using the find command instead of writing a script
Cheers to everyone who added positive info/input. My sincere appreciation.
Jeers (and 1 point) to the individual who had nothing positive to add, excepting command of the English language.
Once again, much appreciated.