Find a file with common initials and last words


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Find a file with common initials and last words
# 1  
Old 04-23-2014
Find a file with common initials and last words

Hi,

I have a requirement like i have to find out files and remove them on a daily basis.

The files are generated as

abc_jnfn_201404230004.csv
abc_jnfo_201404230004.csv
abc_jnfp_201404230004.csv
abc_jnfq_201404230004.csv
abd_jnfn_201404220004.csv
abe_jnfn_201404220004.csv

i want to delete the above files with abc_ as initials and 20140423 as endings.

can you please tell me how can i do it.

i have tried

rm abc_*_20140423* but it is not working

If you can point me to another post which will give the answer i will be thankfull.

Last edited by Mohammed_Tabish; 04-23-2014 at 01:23 AM..
# 2  
Old 04-23-2014
Why is the below code not working and what error you get?
Code:
rm abc_*_20140423*

---------- Post updated at 12:46 AM ---------- Previous update was at 12:42 AM ----------

If you are in the same directory, you can also try the below command depending on the input you have provided
Code:
rm abc_*20140423[0-9][0-9][0-9][0-9].csv

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Versioning up a file with initials?

I have this code that works great ... #!/bin/sh for file in "$@" do ext=${file##*.} base=${file%.*} num=${base##*v} zeroes=${num%%*} num=${num#$zeroes} #remove leading zeros, or it uses octal num=$((num+1)) base=${base%v*} ... (5 Replies)
Discussion started by: scribling
5 Replies

2. Shell Programming and Scripting

Find common lines with one file and with all of the files in another folder

Hi! I would like to comm -12 with one file and with all of the files in another folder that has a 100 files or more (that file is not in that folder) to find common text lines. I would like to have each case that they have common lines to be written to a different output file and the names of the... (6 Replies)
Discussion started by: Eve
6 Replies

3. Shell Programming and Scripting

Find common patterns in multiple file

Hi, I need help to find patterns that are common or matched in a specified column in multiple files. File1.txt ID1 555 ID23 8857 ID4 4454 ID05 555 File2.txt ID74 4454 ID96 555 ID322 4454 (4 Replies)
Discussion started by: redse171
4 Replies

4. UNIX for Advanced & Expert Users

Yum find a very common file in many packages

I am trying to find a yum file that is very common in many packages. I would normally start off with this command, but the file is SO common I don't know which package it is in. yum provides \*compress (1 Reply)
Discussion started by: cokedude
1 Replies

5. Shell Programming and Scripting

Find common words

Hi, I have 10 files which needs to be print common words from those all files. Is there any command to find out. (2 Replies)
Discussion started by: munna_dude
2 Replies

6. Shell Programming and Scripting

Extract common words from two/more csv files

I have two (or more, to make it generic) csv files. Each line contains words separated by comma. None of words have any space. The number of words per line is not fixed. Some may have one, and some may have 12... The number of lines per file is also not fixed. What I need is to find common words... (1 Reply)
Discussion started by: nick2011
1 Replies

7. Shell Programming and Scripting

Find common terms in two text file, xargs, grep

Hello, I'm interested in finding all occurrences of the terms in file1 in file2, which are both csv files. I can do this with a loop but I'm interested in knowing if I can also do it with the help of xargs and grep. What I have tried: cat file1 | xargs grep file2 The problem is that... (15 Replies)
Discussion started by: eon
15 Replies

8. Shell Programming and Scripting

Shell script to find out words, replace them and count words

hello, i 'd like your help about a bash script which: 1. finds inside the html file (it is attached with my post) the code number of the Latest Stable Kernel, 2.finds the link which leads to the download location of the Latest Stable Kernel version, (the right link should lead to the file... (3 Replies)
Discussion started by: alex83
3 Replies

9. Shell Programming and Scripting

search of common words in set of files

Hi, I have a set of simple, one columned text files (in thousands). file1: a b c d file 2: b c d e and so on. There is a collection of words in another file: b d b c d e I have to find out the set of words (in each row) is present or absent in the given set of files. So, the... (4 Replies)
Discussion started by: mala
4 Replies

10. UNIX for Dummies Questions & Answers

how to find common words and take them out from two files

Hi, everyone, Let's say, we have xxx.txt A 1 2 3 4 5 C 1 2 3 4 5 E 1 2 3 4 5 yyy.txt A 1 2 3 4 5 B 1 2 3 4 5 C 1 2 3 4 5 D 1 2 3 4 5 E 1 2 3 4 5 First I match the first column I find intersection (A,C, E), then I want to take those lines with ACE out from yyy.txt, like A 1... (11 Replies)
Discussion started by: kaixinsjtu
11 Replies
Login or Register to Ask a Question