Directory containing files,Print names of the files in the directory that are exactly same content.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Directory containing files,Print names of the files in the directory that are exactly same content.
# 8  
Old 03-23-2017
To reduce the ls invocations, you could apply a small adaption:
Code:
for i in $(ls -r TEST/*)
      do for a in  TEST/*
           do    [ $i == $a ] && break
                 cmp -s $i $a && echo "Matches the $i and $a"
           done
      done

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove all files with specific file names in directory

If I have 5 files in a directory, what is the best way to remove specific files in it? For example, snps.ivg probes.ivg Desired output probes.ivg probes.txt all.txt Basically, removing those files with "snp" in the filename regardless of extension. Thank you :). (2 Replies)
Discussion started by: cmccabe
2 Replies

2. Shell Programming and Scripting

Finding files in directory with similar names

So, I have a directory tree that has many files named thusly: X_REVY.PDF I need to find any files that have the same X portion (which can be nearly anything) as any another file (in any directory) but have different Y portions (which can be any number from 1-99). I then need it to return... (3 Replies)
Discussion started by: Kamezero
3 Replies

3. Shell Programming and Scripting

Edit names of files in a directory

Hi all, I have a directory with multiple (thousnads) of files, which are named this way ABCDEF.wo.im-1 OKRAME.ire.roi IOJEAFO01.irt.gfg IMNYBL05.REG.gkf I would like to keep the part of the name (everything before the first dot in the filename). The desired output: ABCDEF... (3 Replies)
Discussion started by: Error404
3 Replies

4. UNIX for Advanced & Expert Users

Extracts files names and write those to another file in different directory

Hi , Need to shell script to extracts files names and write those to another file in different directory. input file is inputfile.txt abc|1|bcd.dat 123 david123 123 rudy2345 124 tinku5634 abc|1|def.dat 123 jevid123 123 qwer2345 124 ghjlk5634 abc|1|pqr.txt 123 vbjnnjh435 123 jggdy876... (9 Replies)
Discussion started by: dssyadav
9 Replies

5. Shell Programming and Scripting

How to find all files which has names in uppercase in a directory

i want to display all the files which has their names in the Uppercase in a particular directory...guide.. (6 Replies)
Discussion started by: sheelsadan
6 Replies

6. Shell Programming and Scripting

Grepping file names, comparing them to a directory of files, and moving them into a new directory

got it figured out :) (1 Reply)
Discussion started by: sHockz
1 Replies

7. Shell Programming and Scripting

Comparing files names in directory over two servers

Hi folks I need to write a shell script to check whether source and the destination has the same files. The source and destination are over two servers and connecting through ssh. It should even compare the date i.e, the complete file name, date stamp and size should match. Should list out all the... (3 Replies)
Discussion started by: Olivia
3 Replies

8. Shell Programming and Scripting

How to store files names from a directory to an array

Hi I want to store the file names into an array. I have written like this but I am getting error. declare -A arr_Filenames ls -l *.log | set -A arr_Filenames $(awk '{print $9}') index=0 while (( $index < ${#arr_Filenames })); do Current_Filename=${arr_Filenames} ... (5 Replies)
Discussion started by: dgmm
5 Replies

9. UNIX for Dummies Questions & Answers

How can i copy a list of files with different names into others directory have the same name?

dear all. how can i copy a list of files with different names into others directory have the same name like i have 3 files 10_10 10_10_11 10_10_11_12 and i have 3 directories 10_10 10_10_11 10_10_11_12 how can i make a loop to cp this files into the directory have the same name like... (31 Replies)
Discussion started by: t17
31 Replies

10. Shell Programming and Scripting

how can i copy a list of files with different names into others directory have the same name

dear all. how can i copy a list of files with different names into others directory have the same name like i have 3 files 10_10 10_10_11 10_10_11_12 and i have 3 directories 10_10 10_10_11 10_10_11_12 how can i make a loop to cp this files into the directory have the same name like... (0 Replies)
Discussion started by: t17
0 Replies
Login or Register to Ask a Question
POSTCAT(1)						      General Commands Manual							POSTCAT(1)

NAME
postcat - show Postfix queue file contents SYNOPSIS
postcat [-bdehnoqv] [-c config_dir] [files...] DESCRIPTION
The postcat(1) command prints the contents of the named files in human-readable form. The files are expected to be in Postfix queue file format. If no files are specified on the command line, the program reads from standard input. By default, postcat(1) shows the envelope and message content, as if the options -beh were specified. To view message content only, specify -bh (Postfix 2.7 and later). Options: -b Show body content. The -b option starts producing output at the first non-header line, and stops when the end of the message is reached. This feature is available in Postfix 2.7 and later. -c config_dir The main.cf configuration file is in the named directory instead of the default configuration directory. -d Print the decimal type of each record. -e Show message envelope content. This feature is available in Postfix 2.7 and later. -h Show message header content. The -h option produces output from the beginning of the message up to, but not including, the first non-header line. This feature is available in Postfix 2.7 and later. -o Print the queue file offset of each record. -q Search the Postfix queue for the named files instead of taking the names literally. This feature is available in Postfix 2.0 and later. -v Enable verbose logging for debugging purposes. Multiple -v options make the software increasingly verbose. DIAGNOSTICS
Problems are reported to the standard error stream. ENVIRONMENT
MAIL_CONFIG Directory with Postfix configuration files. CONFIGURATION PARAMETERS
The following main.cf parameters are especially relevant to this program. The text below provides only a parameter summary. See postconf(5) for more details including examples. config_directory (see 'postconf -d' output) The default location of the Postfix main.cf and master.cf configuration files. queue_directory (see 'postconf -d' output) The location of the Postfix top-level queue directory. FILES
/var/spool/postfix, Postfix queue directory SEE ALSO
postconf(5), Postfix configuration LICENSE
The Secure Mailer license must be distributed with this software. AUTHOR(S) Wietse Venema IBM T.J. Watson Research P.O. Box 704 Yorktown Heights, NY 10598, USA POSTCAT(1)