Remove matching files from a list


 
Thread Tools Search this Thread
Operating Systems Linux Remove matching files from a list
# 1  
Old 03-28-2014
Remove matching files from a list

hi,

i have a cache file with below file list
Code:
 more gtda_11.cache
GTDA_Dly_Pmix_GB_6_20130624.20130624070610.psv
GTDA_Dly_Pmix_CH_006_20130624.20130624140018.psv
GTDA_Dly_Pmix_GB_6_20130624.20130624070620.psv
GTDA_Dly_Pmix_BE_6_20130624.20130624070620.psv
GTDA_Dly_Pmix_CA_66_20130624.20130624140018.psv

I have other file ABaC.csv with below file list:
Code:
GTDA_Dly_Pmix_CH_006_20130624.20130624140018.psv
GTDA_Dly_Pmix_BE_6_20130624.20130624070620.psv

i want to remove files from gtda_11.cache which are matching with ABaC.csv
i.e : GTDA_Dly_Pmix_CH_006_20130624.20130624140018.psv
GTDA_Dly_Pmix_BE_6_20130624.20130624070620.psv

final out should be:
Code:
more gtda_11.cache
GTDA_Dly_Pmix_GB_6_20130624.20130624070610.psv
GTDA_Dly_Pmix_GB_6_20130624.20130624070620.psv
GTDA_Dly_Pmix_CA_66_20130624.20130624140018.psv

Thanks in advance!!
Smilie

Last edited by vbe; 03-28-2014 at 10:32 AM.. Reason: code tags
# 2  
Old 03-28-2014
Check
Code:
grep -v -f

# 3  
Old 03-28-2014
But I don't what to create new cache file.....I want to find matching files in it and delete it....may be using some for loops...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk to combine all matching dates and remove non-matching

Using the awk below I am able to combine all the matching dates in $1, but I can not seem to remove the non-matching from the file. Thank you :). file 20161109104500.0+0000,x,5631 20161109104500.0+0000,y,2 20161109104500.0+0000,z,2 20161109104500.0+0000,a,4117... (3 Replies)
Discussion started by: cmccabe
3 Replies

2. UNIX for Dummies Questions & Answers

List all files with sum of matching word

grep -c 'avihai' 1.log will give me count of 'avihai' in log I want to have a list of files in the folder that show file name with count side by side. Please advice (2 Replies)
Discussion started by: avihaimar
2 Replies

3. Shell Programming and Scripting

list files not matching wild card

Hi I need a unix command which generates the list of files that dont match the wild card pattern in the current directory say for example I have files like x.addfd.txt.H2012.txt x.addfd.txt.H2012.txt x.asegfd.txt.H2012.txt adfd.bagddf I need the list of files which dont match... (4 Replies)
Discussion started by: lijjumathew
4 Replies

4. UNIX for Dummies Questions & Answers

Script to list non matching files using pattern

Hi, I am trying to write a script that list down all the files that do not match the pattern My pattern will be like this "*.jpg|*.xml|*.sql". This pattern will be stored in a file. The script need to read this pattern from the file and delete the files that does not match this pattern. It... (7 Replies)
Discussion started by: meenavin
7 Replies

5. Shell Programming and Scripting

Remove first row in a list of files

Hi I want to remove the first row in a list of files and am trying to do via the following. I've tried various quotes to redirect the modifed file to a newly named version of itself but no joy. Can you help? > for i in 'ls A*'; do sed '1d' $i > $i"_complete"; done bash: $i"_complete":... (4 Replies)
Discussion started by: ksexton
4 Replies

6. UNIX for Dummies Questions & Answers

remove characters from list of files

done some homework on this-- after i remove up to and including the ) i want to take newfile.txt and use that list to remove the files from a file in my the directory pwd i have a input.txt file cat input,txt 1)mary.jpg 12)john.jpg 100)frankkfkdf .jpg i want to remove the characters in the... (1 Reply)
Discussion started by: plener
1 Replies

7. Shell Programming and Scripting

compare two files and to remove the matching lines on both the files

I have two files and need to compare the two files and to remove the matching lines from both the files (4 Replies)
Discussion started by: shellscripter
4 Replies

8. Shell Programming and Scripting

Remove matching lines with list of strings

Hi, HP-UX gxxxxxxxc B.11.23 U ia64 3717505098 unlimited-user license I have a file with below pipe separated field values: xxx|xxx|abcd|xxx|xxx|xx xxx|xxx|abcd#123|xxx|xxx|xx xxx|xxx|abcd#345|xxx|xxx|xx xxx|xxx|pqrs|xxx|xxx|xx xxx|xxx|pqrs#123|xxx|xxx|xx The third field has values like... (6 Replies)
Discussion started by: Nanu_Manju
6 Replies

9. UNIX for Advanced & Expert Users

Can't list or remove files from a directory

Hi I have a problem. One of the directories in /var, on one of my servers, has filled up with loads of files. I have tried to list the directory to see what is in it, but the 'ls' command just hangs. Same thing happens when I try to use 'rm' to remove files from that directory. I can see what... (2 Replies)
Discussion started by: m_smith
2 Replies

10. UNIX for Dummies Questions & Answers

Too many files to list / remove

I have a directory which has 614,000 files. When attempting to do an ls -ralt in the directory an error too many arguments is shown. 1. I would like to see what files and their stats in the directory 2. I would like to delete certain files of a certain age (3 Replies)
Discussion started by: dinplant
3 Replies
Login or Register to Ask a Question