The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
copying files tjay83 Shell Programming and Scripting 4 08-25-2008 08:52 AM
Error Message while copying- Pls Help geeyess123 UNIX for Advanced & Expert Users 1 08-11-2008 06:47 AM
Copying Files and patilmukundraj SUN Solaris 1 12-30-2007 12:04 PM
Copying files in AWK koti_rama Shell Programming and Scripting 4 08-01-2007 09:55 PM
Copying files alpheusm UNIX for Dummies Questions & Answers 4 10-17-2002 10:18 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 09-28-2008
Registered User
 

Join Date: Jun 2008
Posts: 25
getting error while copying files

I am trying copy all files ,i was getting below error .Please any idea

#find . -name "*bat" -exec cp -p {} /devt/jobs
find: incomplete statement

Thanks,
Akil
Reply With Quote
Forum Sponsor
  #2  
Old 09-28-2008
Registered User
 

Join Date: Mar 2008
Location: /bin/sh
Posts: 352
You are missing a ";" in the statement. Here is another example of find and exec together.

Code:
find /usr/include -type f -exec grep NFS_VERSION {} \; -print

Also, instead of using this command, I would suggest you to use find| xargs command. Following is the example.

Code:
find /usr/include -type f|xargs grep NFS_VERSION
Reply With Quote
  #3  
Old 09-28-2008
Registered User
 

Join Date: Jun 2008
Posts: 25
Hi


I want to copy files from home to /devt/jobs and just want to check with u on the below one

find /usr/include -type f|xargs grep NFS_VERSION--This is destination folder

Thanks,
Akil
Reply With Quote
  #4  
Old 09-29-2008
Registered User
 

Join Date: Mar 2008
Location: /bin/sh
Posts: 352
I tried with this command, and works like a charm..



Code:
find <start directory> -iname "<all my files type>" -exec cp {} <target_dir> \;
Reply With Quote
  #5  
Old 09-29-2008
Registered User
 

Join Date: Jun 2008
Posts: 25
Hi
Thanks its working fine.I want to replace control m charactres current dir and all subdirectories as well.Please help

Thanks,
Akil
Reply With Quote
  #6  
Old 09-29-2008
Registered User
 

Join Date: Mar 2008
Location: /bin/sh
Posts: 352
Following are the solutions for this :

Code:
sed 's/^M//g' ${INPUT_FILE} > tmp.txt
mv  tmp.txt  ${INPUT_FILE}


tr -d "\15"  < ${INPUT_FILE} >  tmp.txt;
mv  tmp.txt  ${INPUT_FILE}


for file in $(find /path/to/dir -type f); do
   tr -d '\r' <$file >temp.$$ && mv temp.$$ $file
done
Feel free to choose your option.If it's a DOS file, check out the command dos2unix.
Reply With Quote
  #7  
Old 09-29-2008
Registered User
 

Join Date: Jun 2008
Posts: 25
Hi
Thanks ,its working fine

Thanks,
Akil
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 04:27 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0