Sponsored Content
Top Forums Shell Programming and Scripting Deleting extra files with similar filenames Post 302358204 by Scrutinizer on Thursday 1st of October 2009 04:31:07 PM
Old 10-01-2009
OK, that is quite a different requirement Smilie. Assuming the duplicates always have " 1" at the end, followed by the extension ".dat", you could try this ksh/bash code:

Code:
BASEDIR='/path/to/dir'
ext='.dat'
duplext=' 1'
find "$BASEDIR" -type d | while read dir; do
  find $dir -name "*$ext" -maxdepth 1 -type f | while read file; do
    duplicate="${file%$ext}$duplext$ext"
    if [[ -f "$duplicate" ]]; then
      rm "$duplicate"
    fi
  done
done


Last edited by Scrutinizer; 10-01-2009 at 05:36 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Appending text to a number of similar filenames

Hi, I was wondering if there was a way to append something to filenames based on a wildcard. For example, if I have the following files in a directory: blah1 blah2 blah3 blah4 blah5 I want to rename these all to: blah1.txt blah2.txt blah3.txt blah4.txt blah5.txt Is there a... (4 Replies)
Discussion started by: Djaunl
4 Replies

2. Shell Programming and Scripting

Deleting the similar lines

Dear Friends myself Avinash working in bash shell The problem goes like this I have a file called work.txt assume that first colum=mac address second colum= IP third colum = port number ---------------------------------------- 00:12:23:34 192.168.50.1 2 00:12:23:35 192.168.50.1 5... (2 Replies)
Discussion started by: avi.skynet
2 Replies

3. Shell Programming and Scripting

csh script for deleting extra spaces in text file

I am new to scripting and I needed to know if there would be an easy way to delete extra spaces in a text file. I have a file with three rows with 22 numbers each, but there is extra spaces between the numbers when it gets output by this program AFNI that I am using. What script would help delete... (2 Replies)
Discussion started by: hertingm
2 Replies

4. Shell Programming and Scripting

removing extra files in dos

Hi, I have same file by name i want to keep only access file and want to delete rest. This is specific to DOS only. Any idea of doing this. I tried so many options but none worked for me. Thanks Namish (11 Replies)
Discussion started by: namishtiwari
11 Replies

5. Shell Programming and Scripting

compare the similar files

I got many pair files, which only have small difference, such as more space, or more empty line, and some unreadable characters. If list by commend "diff", I can see many many difference. So I'd like to write a script to compare the pair files, if 95% contents are same, I will think they are... (2 Replies)
Discussion started by: rdcwayx
2 Replies

6. Shell Programming and Scripting

What extra Parameters I can use for archiving log files

Hello All, I have developed a script which takes following parameter from the input file to archive log files 1)Input Path 2)File pattern(*.csv) 3)Number of days(+1) Following is the algorithm of my script Read the input file go to that path and search for particular n days older... (3 Replies)
Discussion started by: mitsyjohn
3 Replies

7. Shell Programming and Scripting

How to find similar values in different files

Hello, I have 4 files like this: file1: cg24163616 15 297 cg09335911 123 297 cg13515808 565 776 cg12242345 499 705 cg22905282 225 427 cg16674860 286 779 cg14251734 303 724 cg19316579 211 717 cg00612625 422 643 file2:... (2 Replies)
Discussion started by: linseyr
2 Replies

8. Shell Programming and Scripting

Looking to find files that are similar.

Hello all, I have a server that is running AIX, running a tool that converts various printstreams (AFP/Metadata) to PDF. This is done using a rexx script and an off the shelf utility. Each report (there's around 125) uses a certain script file, it's basically a text file. I am trying... (5 Replies)
Discussion started by: jeffs42885
5 Replies

9. UNIX for Dummies Questions & Answers

Sorting files using extra buffer

i want to sort a file which was 4gb of data. my ram sixe was 2gb. so, i want to sort that file using extra buffer , is it possible in unix? if possible plz help me thanks (3 Replies)
Discussion started by: mahesh1987
3 Replies

10. Solaris

Getting similar lines in two files

Hi, I need to compare the /etc/passwd files from 2 servers, and extract the users that are similar in these two files. I sorted the 2 files based on the user IDs (UID) (3rd column). I first sorted the files using the username (1st column), however when I use comm to compare the files there is no... (1 Reply)
Discussion started by: anaigini45
1 Replies
gst-launch-ext-0.8(1)						   User Commands					     gst-launch-ext-0.8(1)

NAME
gst-launch-ext-0.8, gst-launch-ext - run a predefined GStreamer pipeline SYNOPSIS
gst-launch-ext-0.8 filename [filename...] [gst-std-options] gst-launch-ext filename [filename...] [gst-std-options] DESCRIPTION
gst-launch-ext-0.8 runs a basic predefined GStreamer pipeline, and prints the name of the pipeline. gst-launch-ext-0.8 is only used as a quick test to ensure that codecs and GStreamer work properly. gst-launch-ext-0.8 does not handle more advanced features such as synchro- nization. OPTIONS
The following options are supported by gst-launch-ext-0.8 and gst-launch-ext: gst-std-options Standard options available for use with most GStreamer applications. See gst-std-options(5) for more information. The following options are supported by gst-launch-ext only: --gst-list-mm List found major/minor versions. This option displays the versions that are available. --gst-mm=string Force major/minor version. This option enables you to specify a specific version to run, if you do not want to run the default version. --print Print wrapped command line. This option displays the command that will be run, and then runs the command. OPERANDS
The following operands are supported: filename The name of the GStreamer pipeline to run. EXTENDED DESCRIPTION
gst-launch-ext-0.8 can be configured by creating a .gst file in your home directory. This PERL-style configuration file can override the default values for audio and video output sinks. The following example .gst file implements the same defaults as those hard-coded in the script: AUDIOSINK = osssink VIDEOSINK = ffmpegcolorspace ! xvimagesink You can change osssink to esdsink, alsasink, or sunaudiosink, and you can change xvimagesink to ximagesink, aasink, or sdlvideosink. You must have the appropriate plugin installed on the system to use the specified output sink. Other GStreamer plug-ins can also be used. EXAMPLES
Example 1: Launching a GStreamer Pipeline example% gst-launch-ext-0.8 filename EXIT STATUS
The following exit values are returned: 0 Application exited successfully >0 Application exited with failure FILES
The following files are used by this application: /usr/bin/gst-launch-ext-Executable to run a predefined GStreamer pipeline ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWgnome-media | +-----------------------------+-----------------------------+ |Interface stability |External | +-----------------------------+-----------------------------+ SEE ALSO
Latest version of the GNOME Desktop User Guide for your platform. gst-complete(1), gst-compprep(1), gst-feedback(1), gst-inspect(1), gst-launch(1), gst-md5sum(1), gst-register(1), gst-thumbnail(1), gst- typefind(1), gst-xmlinspect(1), gst-xmllaunch(1), gstreamer-properties(1), libgstreamer-0.8(3), libgstgetbits(3), gst-std-options(5) NOTES
Written by Brian Cameron, Sun Microsystems Inc., 2004. SunOS 5.10 14 Oct 2004 gst-launch-ext-0.8(1)
All times are GMT -4. The time now is 11:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy