LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-07-2016, 09:28 AM   #1
rockstar05
Member
 
Registered: Dec 2011
Posts: 83

Rep: Reputation: Disabled
cp -p not working


Hello,

currently, I'm using HP-UX machine.
I would like to copy some of the files, which was generated from 1st Apr to 31st Apr from root user.

I tried with below command but it gives me usage of cp command,


cp -p `ls -lrt |egrep -i "Apr ( [1-9]|1[0-9]|2[0-9]|3[0-1] )"|egrep -v "2004 | 2005 | 2006 | 2007 | 2008 | 2009 | 2010 | 2011 | 2012 | 2013 | 2014 | 2015" | grep root | awk '{print $9}'` /tmp/logs/root/

output,
Usage: cp [-f|-i] [-p] [-S] [-A] [-e warn|force|ignore] source_file target_file
cp [-f|-i] [-p] [-S] [-A] [-e warn|force|ignore] source_file ... target_directory
cp [-f|-i] [-p] [-S] -R|-r [-A] [-e warn|force|ignore] source_directory ... target_directory
cp -R[-H | -L | -P] [-f|-i] [-p] [-S] [-A] [-e warn|force|ignore] source_file ... target
cp -r[-H | -L | -P] [-f|-i] [-p] [-S] [-A] [-e warn|force|ignore] source_file ... target

I think I'm doing something wrong with command. I think HP-UX like Linux but its not.(may be I'm wrong.

Let me know if you need more help,
 
Old 07-07-2016, 10:10 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,661

Rep: Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970
Quote:
Originally Posted by rockstar05 View Post
Hello,
currently, I'm using HP-UX machine. I would like to copy some of the files, which was generated from 1st Apr to 31st Apr from root user. I tried with below command but it gives me usage of cp command,
Code:
cp -p `ls -lrt |egrep -i "Apr ( [1-9]|1[0-9]|2[0-9]|3[0-1] )"|egrep -v "2004 | 2005 | 2006 | 2007 | 2008 | 2009 | 2010 | 2011 | 2012 | 2013 | 2014 | 2015" | grep root | awk '{print $9}'` /tmp/logs/root/

output,
Usage:  cp [-f|-i] [-p] [-S] [-A] [-e warn|force|ignore] source_file target_file
        cp [-f|-i] [-p] [-S] [-A] [-e warn|force|ignore] source_file ... target_directory
        cp [-f|-i] [-p] [-S] -R|-r [-A] [-e warn|force|ignore] source_directory ... target_directory
        cp -R[-H | -L | -P] [-f|-i] [-p] [-S] [-A] [-e warn|force|ignore] source_file ... target
        cp -r[-H | -L | -P] [-f|-i] [-p] [-S] [-A] [-e warn|force|ignore] source_file ... target
I think I'm doing something wrong with command. I think HP-UX like Linux but its not.(may be I'm wrong.
You're VERY wrong. HP/UX is nothing like Linux, at all. If that command works for you on Linux but not HP/UX, then your only solution is to read the man pages on the cp and egrep commands on HP/UX, to figure out what'd different between them. Chances are, you're not using the GNU versions of them, but the HP/UX versions, which have different syntax.
 
  


Reply

Tags
cp



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Wifi not working in Eee PPC 1000HE (Debian Squeeze), but ethernet is working someshpr Linux - Laptop and Netbook 8 10-10-2011 03:59 PM
media problem with .avi --- audio only in vlc working rest amarock ,etc. not working fedex Linux - Newbie 1 12-22-2007 08:06 AM
SED - minor changes work - Larger doesn't (working and non working code included) Nimoy Programming 17 09-22-2007 04:34 PM
Fortemedia FM801 card not working under FC5 on Intel 845 but working with windows morningkiran Linux - Hardware 0 11-30-2006 07:57 AM
acpi nearly working IBM thinkpad R40e 2684HVG no Fn key working, throttling OK Emmanuel_uk Linux - Laptop and Netbook 2 05-31-2006 01:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration