Sponsored Content
Top Forums Shell Programming and Scripting Check for particular files and compare the file names Post 302594794 by knight_eon on Wednesday 1st of February 2012 07:49:04 AM
Old 02-01-2012
Please try this:

Code:
  let MSTNUM=$(echo masterCSF242323.img | sed -e 's/[^0-9]*//g')
  let IDNUM=$(echo indexCSF242323.img | sed -e 's/[^0-9]*//g')
 
  if [[ ${MSTNUM} -eq ${IDNUM} ]]; then
     echo "The numbers are equal"
 else
     echo "They are not"
 fi

You can also use Shell Builtin
Code:
MST=masterCSF242323.img 
MSTNUM=${MST%.img}; MSTNUM=${MSTNUM#masterCSF}
IDT=indexCSF242323.img 
IDNUM=${IDT%.img}; IDNUM=${IDNUM#indexCSF}
 
if [[ ${MSTNUM} -eq ${IDNUM} ]]; then
     echo "The numbers are equal"
else
     echo "They are not"
fi

This User Gave Thanks to knight_eon For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Compare file names

Hi everyone, How to compare between two filenames, in case the current filename is the same as the last one an alarm to be sent, in case the current filename is different from the last filename, no alarm to be sent. Is there a way to do this? Thanks in advance. (4 Replies)
Discussion started by: charbel
4 Replies

2. Shell Programming and Scripting

Compare File Names in Different Directories...

I do not know much about shell scripting and need to create a script and I am at a loss. If someone can help me, that would be great!! I have two directories: /dir1 /dir2 I need to get the sequence number which is part of the filename in /dir1 and delete all files in /dir2 that are... (4 Replies)
Discussion started by: stky13
4 Replies

3. Shell Programming and Scripting

Compare list [ names and size files ]

Hello, I've downloaded a huge amont of files I've got a list of files from a remote server. -rw-r--r-- 1 str661 strem 453465260 Dec 16 15:54 SATRYS2V1_20021218_temp_bias.nc -rw-r--r-- 1 str661 strem 17669468 Dec 16 18:01 SATRYS2V1_20021225_hdyn_bias.nc -rw-r--r-- 1... (9 Replies)
Discussion started by: Aswex
9 Replies

4. UNIX for Dummies Questions & Answers

how to compare names of files?

hi, can somebody tell me how to compare names of files? the situation is I have 2 files file1 and file2 and I want to figure out which file has the biggest ending, in this case file2 is. thank you (3 Replies)
Discussion started by: s3270226
3 Replies

5. Shell Programming and Scripting

Compare file names on directory

Dears, Would you please help on following bash script: I want to get the most recent file named alfaYYYYMMDD.gz in one directory: for example: in directory /tmp/ ls -ltr alfa20130715.gz holding.gz alfa20130705.gz sart.txt merge.txt.gz alfa20130802.gz my result shoud be... (1 Reply)
Discussion started by: maxsub
1 Replies

6. Shell Programming and Scripting

Compare two files and get only missing names

I need to compare two files (oldfile1 & newfile). Need to ignore the values which are present in both files. At the same time, i need to get only records in new file. Tried using Join -v1 -v2 oldfile1 newfile (suspect it has not worked as expected). could anyone of you please help me here. (5 Replies)
Discussion started by: Selva_2507
5 Replies

7. Shell Programming and Scripting

Compare two files containing package names and version number

I have 2 files each containing a list of same fedora packages but with different version number. I want to compare the 2 files and remove the lines containing a newer or older version number (1 Reply)
Discussion started by: asya18
1 Replies

8. Shell Programming and Scripting

Exclude certain file names while selectingData files coming in different names in a file name called

Data files coming in different names in a file name called process.txt. 1. shipments_yyyymmdd.gz 2 Order_yyyymmdd.gz 3. Invoice_yyyymmdd.gz 4. globalorder_yyyymmdd.gz The process needs to discard all the below files and only process two of the 4 file names available ... (1 Reply)
Discussion started by: dsravanam
1 Replies

9. Shell Programming and Scripting

Compare files with different names in different directories

Hi, I have a requirement to compare files in different directories with different names. The files have a datestamp in their name (It might not be a sequential datetimestamp). This is for Redhat Linux. I have more than 5 directories and more than 10 file in each directory to be compared. ... (4 Replies)
Discussion started by: GosarJunk
4 Replies

10. Shell Programming and Scripting

Compare Only "File Names" in 2 Files with file lists having different directory structure

I have a tar arcive arch_all.tar.gz and 4 batched tar archive . These batches are supposed to have all the files form arch1.all.tar.gz arch1_batch1.tar.gz arch1_batch2.tar.gz arch1_batch3.tar.gz arch1_batch4.tar.gz my issue is that the directory structure in "arch_all.tar.gz" is... (6 Replies)
Discussion started by: sumang24
6 Replies
img-xbm(3tk)															      img-xbm(3tk)

NAME
img-xbm - Img, X Windows Bitmap Format (xbm) SYNOPSIS
package require Tk package require img::xbm ?1.3? image create photo ?name? ?options? DESCRIPTION
The package img::xbm is a sub-package of Img. It can be loaded as a part of the complete Img support, via package require Img, or on its own, via package require img::xbm. Like all packages of Img it does not provide new commands, but extends the existing Tk command image so that it supports files containing raster images in the X Windows Bitmap Format (xbm). More specifically img::xbm extends Tk's photo image type. The name of the new format handler is xbm. This handler does not provide additional configuration options. All of the above means that in a call like image create photo ?name? ?options? [1] Image data in xbm format (options -data and -file) is detected automatically. [2] The format name xbm is recognized by the option -format. SEE ALSO
img-bmp, img-gif, img-ico, img-intro, img-jpeg, img-pcx, img-pixmap, img-png, img-ppm, img-ps, img-sgi, img-sun, img-tga, img-tiff, img- window, img-xbm, img-xpm KEYWORDS
image handling, tk, xbm COPYRIGHT
Copyright (c) 1995-2003 Jan Nijtmans <nijtmans@users.sourceforge.com> Img 1.3 img-xbm(3tk)
All times are GMT -4. The time now is 11:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy