- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Question using the find command -
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
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
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
10-15-2005 01:48 PM
10-15-2005 01:48 PM
Re: Question using the find command -
for i in `cat /home/listofhosts`
do
find /somedirectory -type f -name $i -exec cat {} \; >> /var/tmp/bigfile
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2005 02:26 PM
10-15-2005 02:26 PM
SolutionCreate a file with each host name in ie
cat /home/listofhosts
host.1
host.2
host.3
then
for i in `cat /home/listofhosts |awk '{print $1}'`
do
echo "details for host $i" >> /var/tmp/file
find /somedirectory -type f -name "$i.cfg" -exec cat {} \; >> /var/tmp/file
done
HTH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2005 02:49 PM
10-15-2005 02:49 PM
Re: Question using the find command -
Again, Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2005 02:05 AM
10-17-2005 02:05 AM
Re: Question using the find command -
One small point to mention; if you are going to cat somewhere around 4000 files to /onebigfile, you better be sure you have the disk space available. In other words, don't try to save the result in /onebigfile. Filling up / is not good.
Just my 2cts.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2005 07:51 AM
10-17-2005 07:51 AM
Re: Question using the find command -
If I understand what you are trying to do I may have a better idea for you.
You have several file names that are scattered about in a file system with 4000 other files.
You want to find all the files with those names and cat them all into one big file.
If thatâ s the case, you donâ t have to find each file individually you can just find all 4000 files once and grep out the names you are looking for and cat those files to your big file
Find . -xdev -print | grep -e "file1" -e "file2" | while read filename
Do
Cat $filename >> $grut.big.file
Done
Or if you have many file names list them in a pattern file and user grep -f patternfile
If thatâ s not what you are trying to do, then ignore this post.
H
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2005 08:43 AM
10-17-2005 08:43 AM
Re: Question using the find command -
I love this forum because each time I need to do something like this, I can come here then come away with a solution.
Again thanks for your response.
- « Previous
-
- 1
- 2
- Next »