Sponsored Content
Full Discussion: Check for a substring
Top Forums Programming Check for a substring Post 302457311 by Corona688 on Monday 27th of September 2010 05:55:01 PM
Old 09-27-2010
Quote:
Originally Posted by faizlo
All I need is to skip the string if it has any of the 2 substrings I mentioned above.
We've told you how to look for either of those two substrings and that's somehow insufficient, so this is an insufficient explanation of the problem.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Getting a substring

This is probably pretty simple butI'm not sure how to best go about it. If I have FILE="myBigLongFileName_1.xls" FILE_PREFIX=`echo $FILE| cut -d"." -f1` # that gives "myBigLongFileName_1" All i want to do now is chop the "_1" from the end of $FILE_PREFIX Any ideas anyone? (3 Replies)
Discussion started by: djkane
3 Replies

2. Shell Programming and Scripting

how to get substring

i have a strings abc-def.csv ghi-jkl.csv i want to make it as abc-*-def.xyz ghi-*-jkl.xyz How to do it?. (5 Replies)
Discussion started by: senthilk615
5 Replies

3. UNIX for Dummies Questions & Answers

Need help with substring

I need to check the occurrence of one string within another. code ******************** if ;then do something done ******************** Thanks (7 Replies)
Discussion started by: w020637
7 Replies

4. UNIX for Dummies Questions & Answers

Substring

Hi I use the below cmd to get the list of files that are modified than <temp> file in the <path> diretory cmd:find <path> -name '*.zip' -type f -newer <temp> -print i am getting all the list of files that are new or modified, with abs path, i want to copy all of these files to a... (3 Replies)
Discussion started by: Naveen_5960
3 Replies

5. Shell Programming and Scripting

substring

I have a string '<Hi>abc</Hi>" How to print "abc" (6 Replies)
Discussion started by: sandy1028
6 Replies

6. UNIX for Dummies Questions & Answers

Getting Substring

Hi, I hav a string lets say aa.txt:bb:txt length of the string can vary.. I have to keep the token inside a array and the delimiter is : plz send me the code (2 Replies)
Discussion started by: Deekay.p
2 Replies

7. Shell Programming and Scripting

Get the substring

Hi All, I have a ouput string likes 'u8wos' or 'u10acsd' or somthing else 'u{number}{any characters}'and I want to get the number behind the letter 'u' by bash shell. Thanks Damon (11 Replies)
Discussion started by: Damon_Qu
11 Replies

8. Programming

check substring

hi everyone I have a C program where I have a line and I want to check if the line contains a string.The line is stored in a buffer.How can I do that? Can I consider the whole line as a string and check for a substring?And if so what's the most efficient way to achieve it? (1 Reply)
Discussion started by: vlm
1 Replies

9. Shell Programming and Scripting

Substring check in IF condition in shell script

I want to check if the string has the substring in IF condition then process... i tried below but not working if ]; then ............. field can be "reserved1" ....reservedn / fillspaces1 ... fillspacesn (4 Replies)
Discussion started by: greenworld123
4 Replies

10. UNIX for Beginners Questions & Answers

Check if string contains substring surrounded by numbers

Hi, I have a process that generates strings. I would like to check each string and search for substring which contains the letter 'E' surrounded by numbers (both sides of the letter 'E'). few examples: AA4E7012A2 - contains E surrounded by numbers FE18274012 - does not contain E... (3 Replies)
Discussion started by: yanive
3 Replies
Sort::Key::Natural(3pm) 				User Contributed Perl Documentation				   Sort::Key::Natural(3pm)

NAME
Sort::Key::Natural - fast natural sorting SYNOPSIS
use Sort::Key::Natural qw(natsort); my @data = qw(foo1 foo23 foo6 bar12 bar1 foo bar2 bar-45 foomatic b-a-r-45); my @sorted = natsort @data; print "@sorted "; # prints: # b-a-r-45 bar1 bar2 bar12 bar-45 foo foo1 foo6 foo23 foomatic use Sort::Key::Natural qw(natkeysort); my @objects = (...); my @sorted = natkeysort { $_->get_id } @objects; DESCRIPTION
This module extends the Sort::Key family of modules to support natural sorting. Under natural sorting, strings are split at word and number boundaries, and the resulting substrings are compared as follows: o numeric substrings are compared numerically o alphabetic substrings are compared lexically o numeric substrings come always before alphabetic substrings Spaces, symbols and non-printable characters are only considered for splitting the string into its parts but not for sorting. For instance "foo-bar-42" is broken in three substrings "foo", "bar" and 42 and after that the dashes are ignored. Note, that the sorting is case sensitive. To do a case insensitive sort you have to convert the keys explicitly: my @sorted = natkeysort { lc $_ } @data Also, once this module is loaded, the new type "natural" (or "nat") will be available from Sort::Key::Maker. For instance: use Sort::Key::Natural; use Sort::Key::Maker i_rnat_keysort => qw(integer -natural); creates a multikey sorter "i_rnat_keysort" accepting two keys, the first to be compared as an integer and the second in natural descending order. There is also an alternative set of natural sorting functions that recognize floating point numbers. They use the key type "natwf" (abreviation of "natural_with_floats"). FUNCTIONS the functions that can be imported from this module are: natsort @data returns the elements of @data sorted in natural order. rnatsort @data returns the elements of @data sorted in natural descending order. natkeysort { CALC_KEY($_) } @data returns the elements on @array naturally sorted by the keys resulting from applying them "CALC_KEY". rnatkeysort { CALC_KEY($_) } @data is similar to "natkeysort" but sorts the elements in descending order. natsort_inplace @data rnatsort_inplace @data natkeysort_inplace { CALC_KEY($_) } @data rnatkeysort_inplace { CALC_KEY($_) } @data these functions are similar respectively to "natsort", "rnatsort", "natsortkey" and "rnatsortkey", but they sort the array @data in place. $key = mkkey_natural $string given $string, returns a key that can be compared lexicographically to another key obtained in the same manner, results in the same order as comparing the former strings as in the natural order. If the argument $key is not provided it defaults to $_. natwfsort @data rnatwfsort @data natkeywfsort { CALC_KEY($_) } @data rnatkeywfsort { CALC_KEY($_) } @data natwfsort_inplace @data rnatwfsort_inplace @data natkeywfsort_inplace { CALC_KEY($_) } @data rnatkeywfsort_inplace { CALC_KEY($_) } @data mkkey_natural_with_floats $key this ugly named set of functions perform in the same way as its s/natwf/nat/ counterpart with the difference that they honor floating point numbers embeded inside the strings. In this context a floating point number is a string matching the regular expression "/[+-]?d+(.d*)?/". Note that numbers with an exponent part (i.e. "1.12E-12") are not recognized as such. Note also that numbers without an integer part (i.e. .2 or "-.12") are not supported either. SEE ALSO
Sort::Key, Sort::Key::Maker. Other module providing similar functionality is Sort::Naturally. COPYRIGHT AND LICENSE
Copyright (C) 2006, 2012 by Salvador Fandin~o, <sfandino@yahoo.com>. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available. perl v5.14.2 2012-06-30 Sort::Key::Natural(3pm)
All times are GMT -4. The time now is 06:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy