Copying the files after filter


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Copying the files after filter
# 1  
Old 03-06-2013
Copying the files after filter

Hi Guys,

i want copy the all files another direcotry after filtering the command.
and tried as like below...it's not working.

Code:
   ls -ltr|awk '{print $9}'|grep "images\|\.htm"|cp *.* /home/oracle

Thanks
# 2  
Old 03-06-2013
Code:
ls -lrt | awk '{ print $NF}' | egrep ".jpeg|.htm" | xargs -n1 -i cp {} /home/oracle

Note , to search for images, I used .jpeg here, change it as per your requirement.
# 3  
Old 03-06-2013
Thanks...

Sorry for the confusion, i want filter the .images directory ( Direcory name like this index_1154.images) direcory and .htm files in the list of directory.
i did wrong in the above filter. Please can you correct me.
# 4  
Old 03-06-2013
You mean, you want to "search for a directory name and copy it" ? if so,

Code:
ls -lrt | awk '{ print $NF}' | egrep ".images|.htm" | xargs -n1 -i cp -R {} /home/oracle

# 5  
Old 03-06-2013
try find command if you want jpeg or html files being moved to /home/oracle.

Code:
find ./images -type f \( -name "*.jpg" -o -name "*.html" \) -exec 'cp' '{}' '/home/oracle/'

# 6  
Old 03-06-2013
@panyam thank for feeback..

in a directory it contains list of directories names, .htm and .txt files. and i want filter the directories like name as (index_3898.images,index_3899.images so on......).

I need to filter the .images directories and .htm files and moved to /home/oracle
means moved to entrie direcotry and.html files to /home/oracle

Thanks,
# 7  
Old 03-06-2013
Quote:
Originally Posted by bmk
@panyam thank for feeback..

in a directory it contains list of directories names, .htm and .txt files. and i want filter the directories like name as (index_3898.images,index_3899.images so on......).

I need to filter the .images directories and .htm files and moved to /home/oracle
means moved to entrie direcotry and.html files to /home/oracle

Thanks,
Did you try with the command I have given in my previous post. Is it not working?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Filter using awk in CSV files

Hello Gentlemen, Finding difficulties to play with my Input files:confused: . Your guidance will certainly help as always. After converting to csv file from XLSM file, I am getting some extra ""(double quote) characters which I want to terminate inside shell script and process it further. ... (6 Replies)
Discussion started by: pradyumnajpn10
6 Replies

2. UNIX for Dummies Questions & Answers

Filter and merge 2 files problem

Hi, I'm trying to combine two files which have 1 column in common and filter out rows I don't need. File 1: ID Start End Matched Coverage 1 1 254 1515 5.96 2 1 135 402 2.98 File 2 (has 2 rows per entry): >1... (4 Replies)
Discussion started by: Yarinka
4 Replies

3. UNIX for Dummies Questions & Answers

Filter lines common in two files

Thanks everyone. I got that problem solved. I require one more help here. (Yes, UNIX definitely seems to be fun and useful, and I WILL eventually learn it for myself. But I am now on a different project and don't really have time to go through all the basics. So, I will really appreciate some... (6 Replies)
Discussion started by: latsyrc
6 Replies

4. Shell Programming and Scripting

how to filter files with given format

Hi, all, I have files like: nameserver 216.66.22.2 ; tserv1.ash1.ipv6.he.net. tserv13.ash1.ipv6.he.net. nameserver 216.66.38.58 ; tserv1.tor1.ipv6.he.net. tserv21.tor1.ipv6.he.net. nameserver 216.218.221.6 ;... (3 Replies)
Discussion started by: esolvepolito
3 Replies

5. Shell Programming and Scripting

Files copying - [ Listed files alone. ] - Shell script

Hi All, I am doing this for svn patch making. I got the list of files to make the patch. I have the list in a file with path of all the files. To Do From Directory : /myproject/MainDir To Directory : /myproject/data List of files need to copy is in the file: /myproject/filesList.txt ... (4 Replies)
Discussion started by: linuxadmin
4 Replies

6. UNIX for Dummies Questions & Answers

Search and filter between two files

Hello, I have two files in this form that consist of three columns, a name (L*contig*), the length (length=**) and the sequence LT_file.txt LTcontig1 length=13 acccatgctttta LTcontig5 length=8 ggattacc LTcontig8 length=20 ccattgaccgtacctgatcg LTcontig23 length=5 accta and... (5 Replies)
Discussion started by: FelipeAd
5 Replies

7. Shell Programming and Scripting

Filter files and print

Hi, I need to filter and store the files ends with log extension in the array and need to write the file names in the array to a file. I need to use array to derive this solution. Please help me out. Thanks (2 Replies)
Discussion started by: Sekar1
2 Replies

8. Shell Programming and Scripting

Copying a files from a filter list and creating their associated parent directories

Hello all, I'm trying to copy all files within a specified directory to another location based on a find filter of mtime -1 (Solaris OS). The issue that I'm having is that in the destination directory, I want to retain the source directory structure while copying over only the files that have... (4 Replies)
Discussion started by: hunter55
4 Replies

9. Shell Programming and Scripting

Filter only gz files from list of subdirectories

Hi, I have a very big directory structure that consists of many sub-directories inside.There are around 50 ".gz" files under this dir structure. I want to copy all the gz files alone to a seperate location. Plz help me. (2 Replies)
Discussion started by: villain41
2 Replies

10. UNIX for Advanced & Expert Users

copying of files by userB, dir & files owned by userA

I am userB and have a dir /temp1 This dir is owned by me. How do I recursively copy files from another users's dir userA? I need to preserve the original user who created files, original group information, original create date, mod date etc. I tried cp -pr /home/userA/* . ... (2 Replies)
Discussion started by: Hangman2
2 Replies
Login or Register to Ask a Question

Featured Tech Videos