Sponsored Content
Top Forums Shell Programming and Scripting Find files that do not match specific patterns Post 302490882 by nikos-koutax on Wednesday 26th of January 2011 03:32:58 AM
Old 01-26-2011
excuse my ignorance - but I presume I would have to pass your code into a file and then execute it - how would I go about doing this?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

script to match patterns in 2 different files.

I am new to shell scripting and need some help. I googled, but couldn't find a similar scenario. Basically, I need to rename a datafile. This is the scenario - I have a file, readonly.txt that has 2 columns - file# and name. I have another file,missing_files.txt that has id and name. Both the... (3 Replies)
Discussion started by: mathews
3 Replies

2. Shell Programming and Scripting

Using AWK to match CSV files with duplicate patterns

Dear awk users, I am trying to use awk to match records across two moderately large CSV files. File1 is a pattern file with 173,200 lines, many of which are repeated. The order in which these lines are displayed is important, and I would like to preserve it. File2 is a data file with 456,000... (3 Replies)
Discussion started by: isuewing
3 Replies

3. UNIX for Dummies Questions & Answers

move files that match specific conditions

Hi all, I'm new to this forum and bash scripting. I have the following problem, I need to copy some files (from one dir. to another) whose first 5 numbers (subjects' ID) match the directory names. Here a shortened version of what I'm trying to do: names=(32983_f 35416_f 43579_f) # these are... (6 Replies)
Discussion started by: ada1983
6 Replies

4. UNIX for Dummies Questions & Answers

Find diff between two patterns in two files and append

Hi, I'm a newbie at programming in Unix, and I seem to have a task that is greater than I can handle. Trying to learn awk by the way (but in the end, i just need something that works). My goal is to compare two files and output the difference between the two. I've been reading, and I think I... (5 Replies)
Discussion started by: legato22
5 Replies

5. UNIX Desktop Questions & Answers

Combining files with specific patterns of naming in a directory

Greetings Unix exports, I am facing some problems in combining files with different name patterns with a directory and I would appreciate if you can help me I have more than 1000 files but they follow a specific pattern of naming. e.g. 64Xtest01.txt They are divided into two sets of test and... (9 Replies)
Discussion started by: A-V
9 Replies

6. Shell Programming and Scripting

Find matched patterns in multiple files

Hi, I need help to find matched patterns in 30 files residing in a folder simultaneously. All these files only contain 1 column. For example, File1 Gr_1 st-e34ss-11dd bt-wwd-fewq pt-wq02-ddpk pw-xsw17-aqpp Gr_2 srq-wy09-yyd9 sqq-fdfs-ffs9 Gr_3 etas-qqa-dfw ddw-ppls-qqw... (10 Replies)
Discussion started by: redse171
10 Replies

7. Shell Programming and Scripting

Insert a newline after match in files of specific name under some subdirectories?

Hi I'd like to add the newline: \tuser: nobody", or "<TAB>user: nobody to all files named: docker-compose.ymlin subfolders of pwd with names beginning with 10-20. Within these files, I'd like to find the line (there'll only be one) containing: command: celery workerNOTE: As far as... (2 Replies)
Discussion started by: duncanbetts
2 Replies

8. Shell Programming and Scripting

awk to print match or non-match and select fields/patterns for non-matches

In the awk below I am trying to output those lines that Match between file1 and file2, those Missing in file1, and those missing in file2. Using each $1,$2,$4,$5 value as a key to match on, that is if those 4 fields are found in both files the match, but if those 4 fields are not found then missing... (0 Replies)
Discussion started by: cmccabe
0 Replies

9. Shell Programming and Scripting

Bash - Find files excluding file patterns and subfolder patterns

Hello. For a given folder, I want to select any files find $PATH1 -f \( -name "*" but omit any files like pattern name ! -iname "*.jpg" ! -iname "*.xsession*" ..... \) and also omit any subfolder like pattern name -type d \( -name "/etc/gconf/gconf.*" -o -name "*cache*" -o -name "*Cache*" -o... (2 Replies)
Discussion started by: jcdole
2 Replies

10. UNIX for Beginners Questions & Answers

Match patterns between two files and extract certain range of strings

Hi, I need help to match patterns from between two different files and extract region of strings. inputfile1.fa >l-WR24-1:1 GCCGGCGTCGCGGTTGCTCGCGCTCTGGGCGCTGGCGGCTGTGGCTCTACCCGGCTCCGG GGCGGAGGGCGACGGCGGGTGGTGAGCGGCCCGGGAGGGGCCGGGCGGTGGGGTCACGTG... (4 Replies)
Discussion started by: bunny_merah19
4 Replies
More(3pm)						User Contributed Perl Documentation						 More(3pm)

NAME
Carp::Assert::More - convenience wrappers around Carp::Assert VERSION
Version 1.12 SYNOPSIS
use Carp::Assert::More; my $obj = My::Object; assert_isa( $obj, 'My::Object', 'Got back a correct object' ); DESCRIPTION
Carp::Assert::More is a set of wrappers around the Carp::Assert functions to make the habit of writing assertions even easier. Everything in here is effectively syntactic sugar. There's no technical reason to use assert_isa( $foo, 'HTML::Lint' ); instead of assert( defined $foo ); assert( ref($foo) eq 'HTML::Lint' ); other than readability and simplicity of the code. My intent here is to make common assertions easy so that we as programmers have no excuse to not use them. CAVEATS
I haven't specifically done anything to make Carp::Assert::More be backwards compatible with anything besides Perl 5.6.1, much less back to 5.004. Perhaps someone with better testing resources in that area can help me out here. SIMPLE ASSERTIONS
assert_is( $string, $match [,$name] ) Asserts that $string matches $match. assert_isnt( $string, $unmatch [,$name] ) Asserts that $string does NOT match $unmatch. assert_like( $string, qr/regex/ [,$name] ) Asserts that $string matches qr/regex/. assert_defined( $this [, $name] ) Asserts that $this is defined. assert_nonblank( $this [, $name] ) Asserts that $this is not blank and not a reference. NUMERIC ASSERTIONS
assert_integer( $this [, $name ] ) Asserts that $this is an integer, which may be zero or negative. assert_integer( 0 ); # pass assert_integer( -14 ); # pass assert_integer( '14.' ); # FAIL assert_nonzero( $this [, $name ] ) Asserts that the numeric value of $this is not zero. assert_nonzero( 0 ); # FAIL assert_nonzero( -14 ); # pass assert_nonzero( '14.' ); # pass Asserts that the numeric value of $this is not zero. assert_positive( $this [, $name ] ) Asserts that the numeric value of $this is greater than zero. assert_positive( 0 ); # FAIL assert_positive( -14 ); # FAIL assert_positive( '14.' ); # pass assert_nonnegative( $this [, $name ] ) Asserts that the numeric value of $this is greater than or equal to zero. Since non-numeric strings evaluate to zero, this means that any non-numeric string will pass. assert_nonnegative( 0 ); # pass assert_nonnegative( -14 ); # FAIL assert_nonnegative( '14.' ); # pass assert_nonnegative( 'dog' ); # pass assert_negative( $this [, $name ] ) Asserts that the numeric value of $this is less than zero. assert_negative( 0 ); # FAIL assert_negative( -14 ); # pass assert_negative( '14.' ); # FAIL assert_nonzero_integer( $this [, $name ] ) Asserts that the numeric value of $this is not zero, and that $this is an integer. assert_nonzero_integer( 0 ); # FAIL assert_nonzero_integer( -14 ); # pass assert_nonzero_integer( '14.' ); # FAIL assert_positive_integer( $this [, $name ] ) Asserts that the numeric value of $this is greater than zero, and that $this is an integer. assert_positive_integer( 0 ); # FAIL assert_positive_integer( -14 ); # FAIL assert_positive_integer( '14.' ); # FAIL assert_positive_integer( '14' ); # pass assert_nonnegative_integer( $this [, $name ] ) Asserts that the numeric value of $this is not less than zero, and that $this is an integer. assert_nonnegative_integer( 0 ); # pass assert_nonnegative_integer( -14 ); # pass assert_nonnegative_integer( '14.' ); # FAIL assert_negative_integer( $this [, $name ] ) Asserts that the numeric value of $this is less than zero, and that $this is an integer. assert_negative_integer( 0 ); # FAIL assert_negative_integer( -14 ); # pass assert_negative_integer( '14.' ); # FAIL REFERENCE ASSERTIONS
assert_isa( $this, $type [, $name ] ) Asserts that $this is an object of type $type. assert_nonempty( $this [, $name ] ) $this must be a ref to either a hash or an array. Asserts that that collection contains at least 1 element. Will assert (with its own message, not $name) unless given a hash or array ref. It is OK if $this has been blessed into objecthood, but the semantics of checking an object to see if it has keys (for a hashref) or returns >0 in scalar context (for an array ref) may not be what you want. assert_nonempty( 0 ); # FAIL assert_nonempty( 'foo' ); # FAIL assert_nonempty( undef ); # FAIL assert_nonempty( {} ); # FAIL assert_nonempty( [] ); # FAIL assert_nonempty( {foo=>1} );# pass assert_nonempty( [1,2,3] ); # pass assert_nonref( $this [, $name ] ) Asserts that $this is not undef and not a reference. assert_hashref( $ref [,$name] ) Asserts that $ref is defined, and is a reference to a (possibly empty) hash. NB: This method returns false for objects, even those whose underlying data is a hashref. This is as it should be, under the assumptions that: (a) you shouldn't rely on the underlying data structure of a particular class, and (b) you should use "assert_isa" instead. assert_listref( $ref [,$name] ) Asserts that $ref is defined, and is a reference to a (possibly empty) list. NB: The same caveat about objects whose underlying structure is a hash (see "assert_hashref") applies here; this method returns false even for objects whose underlying structure is an array. SET AND HASH MEMBERSHIP
assert_in( $string, @inlist [,$name] ); Asserts that $string is defined and matches one of the elements of @inlist. @inlist must be an array reference of defined strings. assert_exists( \%hash, $key [,$name] ) assert_exists( \%hash, @keylist [,$name] ) Asserts that %hash is indeed a hash, and that $key exists in %hash, or that all of the keys in @keylist exist in %hash. assert_exists( \%custinfo, 'name', 'Customer has a name field' ); assert_exists( \%custinfo, [qw( name addr phone )], 'Customer has name, address and phone' ); assert_lacks( \%hash, $key [,$name] ) assert_lacks( \%hash, @keylist [,$name] ) Asserts that %hash is indeed a hash, and that $key does NOT exist in %hash, or that none of the keys in @keylist exist in %hash. assert_lacks( \%users, 'root', 'Root is not in the user table' ); assert_lacks( \%users, [qw( root admin nobody )], 'No bad usernames found' ); UTILITY ASSERTIONS
assert_fail( [$name] ) Assertion that always fails. "assert_fail($msg)" is exactly the same as calling "assert(0,$msg)", but it eliminates that case where you accidentally use "assert($msg)", which of course never fires. COPYRIGHT
Copyright (c) 2005 Andy Lester. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. ACKNOWLEDGEMENTS
Thanks to Bob Diss, Pete Krawczyk, David Storrs, Dan Friedman, and Allard Hoeve for code and fixes. perl v5.8.8 2005-10-14 More(3pm)
All times are GMT -4. The time now is 06:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy