- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- CP command constraints
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
08-10-2001 07:29 AM
08-10-2001 07:29 AM
I am trying this: cp *.txt >target.file
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2001 07:31 AM
08-10-2001 07:31 AM
Re: CP command constraints
cat file1 file2 >> file3
Eileen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2001 07:48 AM
08-10-2001 07:48 AM
Solutioncp command copies ( source ) file(s) or directory(ies) to ( destination ) file or dirctory respectively.
examples :
1. cp file1 file2 file3 destDir
2. cp -r dir1 dir2 dir3 destDir
If you want to copy the content of files then use cat command ( as mentioned before ).
cat sourceFile1 sourceFile2 sourceFile3 >> destinationFile
Magdi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2001 07:48 AM
08-10-2001 07:48 AM
Re: CP command constraints
If you'd only had two files, you'd have overwritten one with the other, since the command would expand to:
cp file1.txt file2.txt > file3
file2 would then be a copy of file1, file3 would contain nothing.
More than 2 and you'd just get the error you describe. Use cat, as suggested.
Rgds, Robin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2001 08:00 AM
08-10-2001 08:00 AM
Re: CP command constraints
I tried this
cp *.txt /
like i went to /etc and gave
cp *.log /tmp and it copied all files with *.log under /tmp with the same name .
Also after you have copied and want to combine it into a single file then
cat *.txt >
Manoj Srivastava
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2001 08:12 AM
08-10-2001 08:12 AM
Re: CP command constraints
You gotten the correct answers but why not do this the real unix way and have your parser simply read stdin (in this case a pipe) and then write to stdout.
e.g. cat file1 file2 file3 | myprogram > newfile.
This way 'myprogram' acts as a filter and is the typical way to do this in a unix environment.
Regards, Clay