Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Help in Find command filter test files Post 302228013 by Mariognarly on Friday 22nd of August 2008 02:10:28 PM
Old 08-22-2008
You can also use:

find . -name test -print.

You can use regular expressions with it as well. Example of a wildcard search:

find . -name *test* -print
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Renameing files with the find command

Hi, I am attempting to rename files in a directory tree, using the find command: find . -name "file-src*" -exec mv {} file-tgt \; however, this only moves the file to the current dir: I have also tried: mv 'find . -name file-src' file-tar find . -name "file-src*" -exec mv {file-tgt} \;... (6 Replies)
Discussion started by: Breen
6 Replies

2. Shell Programming and Scripting

Little bit weired : Find files in UNIX w/o using find or where command

Yes , I have to find a file in unix without using any find or where commands.Any pointers for the same would be very helpful as i am beginner in shell scritping and need a solution for the same. Thanks in advance. Regards Jatin Jain (10 Replies)
Discussion started by: jatin.jain
10 Replies

3. Shell Programming and Scripting

Deleting files using find command

I want to find the files and delete all the files except the last file. I am using find command , I am sending the find output to a file and getting all the lines except the last one and sending it to the remove command . This is not working. can anyone help me out to do it in the find command... (8 Replies)
Discussion started by: deepaklanka
8 Replies

4. Shell Programming and Scripting

what is the find to command to find the files created last 30 days

what is the find to command to find the files created last 30 days (5 Replies)
Discussion started by: rajkumar_g
5 Replies

5. UNIX for Dummies Questions & Answers

command to find files

Hi folks, What command/commands I have to run to find the files including their folder/subfolder which contain word-a, word-b etc. e.g. I expect to find the names of the files including their folders which contain "domain", "subdomain/sub domain", "free domain". etc. TIA B.R. satimis (11 Replies)
Discussion started by: satimis
11 Replies

6. Shell Programming and Scripting

find command to filter specific type of files older than certain date.

Hi I need to find the list of files in a directory and to do some specific operations based on the type of files. suppose in a directory am having .dat , .log, .err, .rej file types. i need to filter out .dat and .log only which are older than six months. i used the below query but the... (2 Replies)
Discussion started by: msathees
2 Replies

7. UNIX for Dummies Questions & Answers

Command to find files

Hi All, Can anyone give me the command to copy files from 03-Mar-2013 to 07-Mar-2013 in folder. there are nearly 40+ thousand files in directory , so I just need files from Mar 3rd to Mar 7th and copy them to a location . Need quick help pls (2 Replies)
Discussion started by: rockingvj
2 Replies

8. Shell Programming and Scripting

Find patterns and filter the text

I need to filter the text in between two patterns and output that to a different file. Please help me how to do it. Ex: ............. <some random text> ............. Pattern_1 <Few lines that need to be output to different file> Pattern_2 ................ ............... <more text in... (4 Replies)
Discussion started by: metturr
4 Replies

9. Shell Programming and Scripting

Find command to delete the files

Hi All, I've created 2 files touch -t 201309101234 aa10 touch -t 201309111234 aa11 Exact 60 days before from today date is SEPT 12th . As per the following command as i gave +60 means the files which were created before sept12th should be deleted find /etc/logs/*aa* -type f -atime +60... (5 Replies)
Discussion started by: smile689
5 Replies

10. Shell Programming and Scripting

Find command to find a word from list of files

I need to find a word '% Retail by State' in the folder /usr/sas/reports/RetailSalesTaxallocation. When I tried like below, -bash-4.1$ cd /usr/sas/reports/RetailSalesTaxallocation -bash-4.1$ find ./ -name % Retail by State find: paths must precede expression: Retail Usage: find ... (10 Replies)
Discussion started by: Ram Kumar_BE
10 Replies
Test::LongString(3pm)					User Contributed Perl Documentation				     Test::LongString(3pm)

NAME
Test::LongString - tests strings for equality, with more helpful failures SYNOPSIS
use Test::More tests => 1; use Test::LongString; like_string( $html, qr/(perl|cpan).org/ ); # Failed test (html-test.t at line 12) # got: "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Trans"... # length: 58930 # doesn't match '(?-xism:(perl|cpan).org)' DESCRIPTION
This module provides some drop-in replacements for the string comparison functions of Test::More, but which are more suitable when you test against long strings. If you've ever had to search for text in a multi-line string like an HTML document, or find specific items in binary data, this is the module for you. FUNCTIONS
is_string( $string, $expected [, $label ] ) "is_string()" is equivalent to "Test::More::is()", but with more helpful diagnostics in case of failure. o It doesn't print the entire strings in the failure message. o It reports the lengths of the strings that have been compared. o It reports the length of the common prefix of the strings. o It reports the line and column the strings started to differ on. o In the diagnostics, non-ASCII characters are escaped as "x{xx}". For example: is_string( $soliloquy, $juliet ); # Failed test (soliloquy.t at line 15) # got: "To be, or not to be: that is the question:x{0a}Whether"... # length: 1490 # expected: "O Romeo, Romeo,x{0a}wherefore art thou Romeo?x{0a}Deny thy"... # length: 154 # strings begin to differ at char 1 (line 1 column 1) is_string_nows( $string, $expected [, $label ] ) Like "is_string()", but removes whitepace (in the "s" sense) from the arguments before comparing them. like_string( $string, qr/regex/ [, $label ] ) unlike_string( $string, qr/regex/ [, $label ] ) "like_string()" and "unlike_string()" are replacements for "Test::More:like()" and "unlike()" that only print the beginning of the received string in the output. Unfortunately, they can't print out the position where the regex failed to match. like_string( $soliloquy, qr/Romeo|Juliet|Mercutio|Tybalt/ ); # Failed test (soliloquy.t at line 15) # got: "To be, or not to be: that is the question:x{0a}Whether"... # length: 1490 # doesn't match '(?-xism:Romeo|Juliet|Mercutio|Tybalt)' contains_string( $string, $substring [, $label ] ) "contains_string()" searches for $substring in $string. It's the same as "like_string()", except that it's not a regular expression search. contains_string( $soliloquy, "Romeo" ); # Failed test (soliloquy.t at line 10) # searched: "To be, or not to be: that is the question:x{0a}Whether"... # and can't find: "Romeo" As of version 0.12, "contains_string()" will also report the Longest Common SubString (LCSS) found in $string and, if the LCSS is short enough, the surroundings will also be shown under LCSS Context. This should help debug tests for really long strings like HTML output, so you'll get something like: contains_string( $html, '<div id="MainContent">' ); # Failed test at t/foo.t line 10. # searched: "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Stric"... # can't find: "<div id="MainContent">" # LCSS: "ainContent"" # LCSS context: "dolor sit amet</span>x{0a}<div id="mainContent" class=" You can turn off LCSS reporting by setting $Test::LongString::LCSS to 0, or by specifying an argument to "use": use Test::LongString lcss => 0; lacks_string( $string, $substring [, $label ] ) "lacks_string()" makes sure that $substring does NOT exist in $string. It's the same as "like_string()", except that it's not a regular expression search. lacks_string( $soliloquy, "slings" ); # Failed test (soliloquy.t at line 10) # searched: "To be, or not to be: that is the question:x{0a}Whether"... # and found: "slings" # at position: 147 (line 3 column 4) CONTROLLING OUTPUT
By default, only the first 50 characters of the compared strings are shown in the failure message. This value is in $Test::LongString::Max, and can be set at run-time. You can also set it by specifying an argument to "use": use Test::LongString max => 100; When the compared strings begin to differ after a large prefix, Test::LongString will not print them from the beginning, but will start at the middle, more precisely at $Test::LongString::Context characters before the first difference. By default this value is 10 characters. If you want Test::LongString to always print the beginning of compared strings no matter where they differ, undefine $Test::LongString::Context. When computing line numbers this module uses " " to count line endings. This may not be appropriate for strings on your platform, and can be overridden by setting the $Test::LongString::EOL variable to a suitable regular expression (either a reference to a regular expression or a string that can be interpolated into a regular expression.) You can also set it by specifying an argument to "use": use Test::LongString eol => "x{0a}x{0c}"; AUTHOR
Written by Rafael Garcia-Suarez. Thanks to Mark Fowler (and to Joss Whedon) for the inspirational Acme::Test::Buffy. Thanks to Andy Lester for lots of patches. This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself. A git repository for this module is available at git://github.com/rgs/Test-LongString.git SEE ALSO
Test::Builder, Test::Builder::Tester, Test::More. perl v5.10.1 2011-02-08 Test::LongString(3pm)
All times are GMT -4. The time now is 08:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy