Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Need to exclude certain file extensions while listing the file using ls Post 302840545 by 100bees on Tuesday 6th of August 2013 01:11:52 AM
Old 08-06-2013
Need to exclude certain file extensions while listing the file using ls

Hi friends,
I need to check for the latest file
say i have list of files like this

Code:
test_files
test_files.1
test_files.2
test_files.3.bin.Z

I do it this way

Code:
ls -lrt test_files*|tail -1

Now i need to exclude test_files.3.bin.Z even if it is the latest file,how do i do it?

tried

Code:
ls -lrt test_files*|grep -v *.bin.Z

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

File name extensions

Hello people, I was wondering if anyone could help me? I want to produce a shell script that changes the filename extension on all matching file. E.G. change all files called ‘something.rtf' to ‘something.doc' by giving the command: Changex rtf doc *where ‘Changex' is the name of... (2 Replies)
Discussion started by: thurrock
2 Replies

2. Shell Programming and Scripting

File extensions in a dir

Hi All, Is there a way to list all file extensions in a directory and its recursive dirs? Thanks (5 Replies)
Discussion started by: ganga.dharan
5 Replies

3. UNIX for Dummies Questions & Answers

Find all the unique file extensions

Hi How can i find the unique list of file extensions in a folder/subfolders e.g. MAIN/ a.txt b.txt a.clas a.java b.class a.txt.112 c.12.ram.jar i just need to get the below out irrespective of file being present in folder or subfolders txt clas java (5 Replies)
Discussion started by: reldb
5 Replies

4. Shell Programming and Scripting

Checking file extensions

I am trying to store file with certain file extensions to list but having some problems. Here is a part of the code set fryLst = "" set fxtLst = "" foreach f ($AfullNameLst) set fname = $f:r set fext = $f:e if ("$fext" == ".ry") set fryLst = "$fryLst $f" if ("$fext" == ".xt")... (2 Replies)
Discussion started by: kristinu
2 Replies

5. Shell Programming and Scripting

Checking file extensions

I'm in csh and have a list of file names, example set Lst = "file1.ry file2.ry file3.ry file4.ry" I want to check if all the extensions are ry. Is they are, I want to do something. (1 Reply)
Discussion started by: kristinu
1 Replies

6. Ubuntu

[Solved] Using Find with an exclude/exclude file

I am familiar with using tar and exclude/include files: tar zcf backup.dirs.tgz --files-from=include.mydirs --exclude-from=exclude.mydirs --no-recursion but was wondering if I could use find in the same way. I know that you can just specify the directories to exclude but my list is... (2 Replies)
Discussion started by: metallica1973
2 Replies

7. Emergency UNIX and Linux Support

Sorting file content by file extensions

Hi Experts, I have one .txt file which has filenames with various extensions e.g. .gz,.dat,.CTL,.xml. I want to sort all the filenames as per their extensions and would like to delete all the file names with .xml extension. Please help. PS : I am using Sun OS Generic_122300-60. ... (9 Replies)
Discussion started by: ajaypatil_am
9 Replies

8. Shell Programming and Scripting

Search for file extensions in the given directories

Hey guys, I'm lost... I need to make a script that will work in this way: ./script.sh -e sh /usr/bin /home/student this script will result in this output: amuFormat.sh /usr/bin gettext.sh /urs/bin perfect.sh /home/student the parameter -e <ext> gives you which... (2 Replies)
Discussion started by: Miki1579
2 Replies

9. Shell Programming and Scripting

Remove comments from file with specific file name extensions

Hello Unix board community, I have to program a shell script, but I am a complete noob so I hope I get some help here. The assignment is as follows: The program removes all comments regardless of formatting or language from files with specific file name extensions (php, css, js, ...).... (3 Replies)
Discussion started by: TheZeusMan
3 Replies

10. Shell Programming and Scripting

Comparing file names with different extensions

Hello, I need some help. I have files in one and the same directory, but with different extensions, like this: file1.IN file2.IN file3.IN file1.OUT file2.OUT Apparently some files with OUT extension can be missing. So I want to compare *.IN and *.OUT, ignoring the extension and get result... (3 Replies)
Discussion started by: apenkov
3 Replies
Test::Harness(3pm)					 Perl Programmers Reference Guide					Test::Harness(3pm)

NAME
Test::Harness - Run Perl standard test scripts with statistics VERSION
Version 3.23 SYNOPSIS
use Test::Harness; runtests(@test_files); DESCRIPTION
Although, for historical reasons, the Test::Harness distribution takes its name from this module it now exists only to provide TAP::Harness with an interface that is somewhat backwards compatible with Test::Harness 2.xx. If you're writing new code consider using TAP::Harness directly instead. Emulation is provided for "runtests" and "execute_tests" but the pluggable 'Straps' interface that previous versions of Test::Harness supported is not reproduced here. Straps is now available as a stand alone module: Test::Harness::Straps. See TAP::Parser, TAP::Harness for the main documentation for this distribution. FUNCTIONS
The following functions are available. runtests( @test_files ) This runs all the given @test_files and divines whether they passed or failed based on their output to STDOUT (details above). It prints out each individual test which failed along with a summary report and a how long it all took. It returns true if everything was ok. Otherwise it will "die()" with one of the messages in the DIAGNOSTICS section. execute_tests( tests => @test_files, out => *FH ) Runs all the given @test_files (just like "runtests()") but doesn't generate the final report. During testing, progress information will be written to the currently selected output filehandle (usually "STDOUT"), or to the filehandle given by the "out" parameter. The out is optional. Returns a list of two values, $total and $failed, describing the results. $total is a hash ref summary of all the tests run. Its keys and values are this: bonus Number of individual todo tests unexpectedly passed max Number of individual tests ran ok Number of individual tests passed sub_skipped Number of individual tests skipped todo Number of individual todo tests files Number of test files ran good Number of test files passed bad Number of test files failed tests Number of test files originally given skipped Number of test files skipped If "$total->{bad} == 0" and "$total->{max} > 0", you've got a successful test. $failed is a hash ref of all the test scripts that failed. Each key is the name of a test script, each value is another hash representing how that script failed. Its keys are these: name Name of the test which failed estat Script's exit value wstat Script's wait status max Number of individual tests failed Number which failed canon List of tests which failed (as string). $failed should be empty if everything passed. EXPORT
&runtests is exported by "Test::Harness" by default. &execute_tests, $verbose, $switches and $debug are exported upon request. ENVIRONMENT VARIABLES THAT TAP
::HARNESS::COMPATIBLE SETS "Test::Harness" sets these before executing the individual tests. "HARNESS_ACTIVE" This is set to a true value. It allows the tests to determine if they are being executed through the harness or by any other means. "HARNESS_VERSION" This is the version of "Test::Harness". ENVIRONMENT VARIABLES THAT AFFECT TEST
::HARNESS "HARNESS_TIMER" Setting this to true will make the harness display the number of milliseconds each test took. You can also use prove's "--timer" switch. "HARNESS_VERBOSE" If true, "Test::Harness" will output the verbose results of running its tests. Setting $Test::Harness::verbose will override this, or you can use the "-v" switch in the prove utility. "HARNESS_OPTIONS" Provide additional options to the harness. Currently supported options are: "j<n>" Run <n> (default 9) parallel jobs. "c" Try to color output. See "new" in TAP::Formatter::Base. Multiple options may be separated by colons: HARNESS_OPTIONS=j9:c make test "HARNESS_SUBCLASS" Specifies a TAP::Harness subclass to be used in place of TAP::Harness. Taint Mode Normally when a Perl program is run in taint mode the contents of the "PERL5LIB" environment variable do not appear in @INC. Because "PERL5LIB" is often used during testing to add build directories to @INC "Test::Harness" passes the names of any directories found in "PERL5LIB" as -I switches. The net effect of this is that "PERL5LIB" is honoured even in taint mode. SEE ALSO
TAP::Harness BUGS
Please report any bugs or feature requests to "bug-test-harness at rt.cpan.org", or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Harness <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Harness>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. AUTHORS
Andy Armstrong "<andy@hexten.net>" Test::Harness 2.64 (maintained by Andy Lester and on which this module is based) has this attribution: Either Tim Bunce or Andreas Koenig, we don't know. What we know for sure is, that it was inspired by Larry Wall's F<TEST> script that came with perl distributions for ages. Numerous anonymous contributors exist. Andreas Koenig held the torch for many years, and then Michael G Schwern. LICENCE AND COPYRIGHT
Copyright (c) 2007-2011, Andy Armstrong "<andy@hexten.net>". All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic. perl v5.16.2 2012-10-25 Test::Harness(3pm)
All times are GMT -4. The time now is 01:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy