- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- HELP needed with simple 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
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
12-29-2004 10:52 PM
12-29-2004 10:52 PM
cd /directory_1
for i in `ls *`
do
cat $i >> file
done
cd /directory_2
for i in `ls *`
do
cat $i >> file
done
etc etc
Is there a way of doing this in one sweep? I ALSO need to concatenate the files in a particular order
Thanks in advance - Declan
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2004 11:02 PM
12-29-2004 11:02 PM
Re: HELP needed with simple script
find /start -type f -exec cat {} >> file \;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2004 11:05 PM
12-29-2004 11:05 PM
Solution--8<---
cd /dir1
cat * >>file
cd /dir2
cat * >>file
-->8---
be sure that 'file' is not in any of these dir's, because that will yield unexpected errors
be aware that '*' will exclude all files that start with a dot (.) and it includes directories, which might also not be what you want
If the directories you want do not contain subfolders, you could do
# find /dir1 /dir2 /dir3 -type f -exec cat {} >>file \;
or if there are not too many files, faster
# find /dir1 /dir2 /dir3 -type f | xargs cat >file
As you didn't tell us where and how the order of the files is determined, I cannot answer that question (yet).
Enjoy, Have FUN! H.merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2004 11:07 PM
12-29-2004 11:07 PM
Re: HELP needed with simple script
try this
cd /
for i in *
do
if (-d $i)
cd $i
for x in *
cat $x >> file
done
fi
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2004 11:07 PM
12-29-2004 11:07 PM
Re: HELP needed with simple script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2004 11:11 PM
12-29-2004 11:11 PM
Re: HELP needed with simple script
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2004 11:27 PM
12-29-2004 11:27 PM
Re: HELP needed with simple script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2004 11:36 PM
12-29-2004 11:36 PM
Re: HELP needed with simple script
context switches are expensive on multiuser systems
Enjoy, Have FUN! H.Merijn