Duplicate name diff file ext


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Duplicate name diff file ext
# 1  
Old 10-01-2011
Duplicate name diff file ext

Hi All

I have converted a load of files to different formats but I am now left with a folder with loads of differnt files

All of them are called the same, the only differnce is the file extension (Sizes also vary so cannot do anything with MD5)

example
file1.abc
file1.xyz
file2.abc
file2.xyz

I am after a bash script to search the folder and move the abc files but only if there is a xyz file

Not sure if all converted so need to make sure only the originals which converted are moved

Can anyone help
# 2  
Old 10-01-2011
Perhaps the following is enough to give you a jumpstart to the final solution:
Code:
for f in *.abc; do
    if [ -e "${f%.*}".xyz ]; then
        echo xyz version exists
    fi
done

Regards and welcome to the forum,
Alister
# 3  
Old 10-01-2011
cool

i could just replace the below with a move command i think

Cheers
echo xyz version exists
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ext File

I have a log file that I want to extract the field name and the field value and write them to a text file for importation it a database table for reporting purposes. How can I extract the desired data from this file . Example: dbt_dbid=4 dbt_dbid is the field name 4 is the field value... (4 Replies)
Discussion started by: JolietJake
4 Replies

2. Shell Programming and Scripting

Script to monitor for new file with ext .err and size > 0 bytes and perform a action or command

Hi All, I need to create a script to monitor a dir for new files with ext .err and also it should b a non empty files. and perform a action or command . We have a new ETL application that runs on a linux server, every times a etl fails it creates a .err file or updates the existing .err... (4 Replies)
Discussion started by: MAKHAN
4 Replies

3. Shell Programming and Scripting

serach diff filename in diff location using shell scripting

Hi, I am new to shell scripting. please help me to find out the solution. I need a script where we need to read the text file(consists of all file names) and get the file names one by one and append the date suffix for each file name as 'yyyymmdd' . Then search each file if exists... (1 Reply)
Discussion started by: Lucky123
1 Replies

4. Shell Programming and Scripting

.procmailrc and uudeview (put attachments from diff senders to diff folders)

Moderator, please, delete this topic (1 Reply)
Discussion started by: optik77
1 Replies

5. UNIX for Advanced & Expert Users

shred() not working on ext* file systems

When vfat format my128kb flash drive, shred works fine. But, when I format it using ext2 or ext3, shred() exits with this error: shred: /dev/sdb1: pass 1/1 (random)... shred: /dev/sdb1: error writing at offset 12288: Invalid argumentAnyone know what is going on? (0 Replies)
Discussion started by: codecellar
0 Replies

6. Shell Programming and Scripting

Simulate SVN diff using plain diff

Hi, svn diff does not work very well with 2 local folders, so I am trying to do this diff using diff locally. since there's a bunch of meta files in an svn directory, I want to do a diff that excludes everything EXCEPT *.java files. there seems to be only an --exclude option, so I'm not sure... (3 Replies)
Discussion started by: ackbarr
3 Replies

7. Shell Programming and Scripting

rename file to file.ext.datetime

Hi, I need to rename a file like this to include date and time: Original File : error.log Date time: Sep 20, 2007 14:10:10 New File Name: error.log.20070920_1410 How can I get date and time stame and include it in mv command. Thanks in advance (2 Replies)
Discussion started by: tripsat
2 Replies

8. UNIX for Dummies Questions & Answers

diff on compressed files with tar.gz ext

how can I find out what is the difference between two tar.gz files without uncompressing them. thank you. (7 Replies)
Discussion started by: rakeshou
7 Replies

9. Shell Programming and Scripting

diff 2 files; output diff's to 3rd file

Hello, I want to compare two files. All records in file 2 that are not in file 1 should be output to file 3. For example: file 1 123 1234 123456 file 2 123 2345 23456 file 3 should have 2345 23456 I have looked at diff, bdiff, cmp, comm, diff3 without any luck! (2 Replies)
Discussion started by: blt123
2 Replies
Login or Register to Ask a Question