Sponsored Content
Top Forums Shell Programming and Scripting Regular Expression to exclude pattern Post 302328487 by kingpin2502 on Wednesday 24th of June 2009 11:48:15 AM
Old 06-24-2009
Okay tried this

(!^[A-Z]{3}_SPTR)..*_PUT_EUROPEAN,NOSPTR,

But this doesn't match the second line.

If I do this

(?!^[A-Z]{3}_SPTR)..*_PUT_EUROPEAN,NOSPTR,

It includes both lines which is not quite what I want.

My perl command, stripped from the global file is this

$s_UniqueID =~ m/(?!^[A-Z]{3}_SPTR)..*_PUT_EUROPEAN/
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk + pattern search with regular expression

Hi , I have a file with "|" (pipe) as a delimeter. I am looking for the record count where 5th field is a number with 15 digit length only. all the records with above requirement is valid rest all are invalid. I need count of valid records and invalid records. Can anyone please help (9 Replies)
Discussion started by: vikash_k
9 Replies

2. Shell Programming and Scripting

Perl regular expression for exclude specific ip range

I need regular expression for excluding specific range. e.g. Input Data is 10.10.10.50 67.172.15.15 10.10.10.15 78.122.105.108 I would like to extract only 67.172.15.15 & 78.122.105.108. I tried with something like /(^10.10.10)/ but it's not working. Please help me on this (17 Replies)
Discussion started by: nrbhole
17 Replies

3. Shell Programming and Scripting

validate date pattern using Regular Expression

Hi, i am java guy and new to unix. I want to validate date pattern using Regex expression here is the sample program i have written. #!/bin/sh checkDate="2010-04-09" regex="\\d{4}-\\d{2}-\\d{2}\$" echo $regex if ] then echo "OK" else echo "not OK" fi But the ouput is... (2 Replies)
Discussion started by: vvenu88
2 Replies

4. Shell Programming and Scripting

Validate time pattern using regular expression

Hi, I am new to scripting. please help me in validating the user entered time Pattern Here is the program #!/bin/bash validateTimeFormat() { checkTime=$1 timePattern="::" if ] then echo "Valid time pattern" return 1 else echo "InValid time pattern" return -1 fi } echo "Please... (2 Replies)
Discussion started by: vvenu88
2 Replies

5. Shell Programming and Scripting

Regular Expression for Random pattern

What would be the regular expression that can search for a Pattern, having 8 characters out of which atleast 1 digit, 1 lower case, 1 upper case letter and 1 special character must be there. But these can occur at any place randomly. Please help me out. I'm using find $dir -name "*.txt" -exec... (0 Replies)
Discussion started by: Pradeep Kr.
0 Replies

6. Shell Programming and Scripting

Integer expression expected: with regular expression

CA_RELEASE has a value of 6. I need to check if that this is a numeric value. if not error. source $CA_VERSION_DATA if * ] then echo "CA_RELESE $CA_RELEASE is invalid" exit -1 fi + source /etc/ncgl/ca_version_data ++ CA_PRODUCT_ID=samxts ++ CA_RELEASE=6 ++ CA_WEEK_NO=7 ++... (3 Replies)
Discussion started by: ketkee1985
3 Replies

7. Programming

Perl: How to read from a file, do regular expression and then replace the found regular expression

Hi all, How am I read a file, find the match regular expression and overwrite to the same files. open DESTINATION_FILE, "<tmptravl.dat" or die "tmptravl.dat"; open NEW_DESTINATION_FILE, ">new_tmptravl.dat" or die "new_tmptravl.dat"; while (<DESTINATION_FILE>) { # print... (1 Reply)
Discussion started by: jessy83
1 Replies

8. UNIX for Advanced & Expert Users

sed: -e expression #1, char 0: no previous regular expression

Hello All, I'm trying to extract the lines between two consecutive elements of an array from a file. My array looks like: problem_arr=(PRS111 PRS213 PRS234) j=0 while } ] do k=`expr $j + 1` sed -n "/${problem_arr}/,/${problem_arr}/p" problemid.txt ---some operation goes... (11 Replies)
Discussion started by: InduInduIndu
11 Replies

9. Shell Programming and Scripting

Pattern search (regular expression in UNIX)

Hello , Could anyone help me to define the string in regular expression way . Below is my string \rtf1\ansi\deff0{\fonttbl{\f0\fswiss Helv;}{\f1\fnil MS Sans Serif;}} {\colortbl ;\red0\green0\blue0;} \viewkind4\uc1\pard\cf1\lang1033\f0\fs16 The string will always start as \rtf1 and... (6 Replies)
Discussion started by: Pratik4891
6 Replies

10. Shell Programming and Scripting

Regular Expression repeat pattern

Hi, I'm struggling with very very simple task but dont know where I'm going wrong. Have the following file numbers.txt 1 12 123 1234 12345 123456 1234567 12345678 123456789 1234567890 9876543210 987654321 98765432 9876543 987654 98765 (1 Reply)
Discussion started by: bobbygsk
1 Replies
FusionInventory::Agent::Tools(3pm)			User Contributed Perl Documentation			FusionInventory::Agent::Tools(3pm)

NAME
FusionInventory::Agent::Tools - OS-independant generic functions DESCRIPTION
This module provides some OS-independant generic functions. FUNCTIONS
getFormatedLocalTime($time) Returns a formated date from given Unix timestamp. getFormatedGmTime($time) Returns a formated date from given Unix timestamp. getFormatedDate($year, $month, $day, $hour, $min, $sec) Returns a formated date from given date elements. getCanonicalManufacturer($manufacturer) Returns a normalized manufacturer value for given one. getCanonicalSpeed($speed) Returns a normalized speed value (in Mhz) for given one. getCanonicalSize($size) Returns a normalized size value (in Mb) for given one. getSanitizedString($string) Returns the input stripped from any control character, properly encoded in UTF-8. compareVersion($major, $minor, $min_major, $min_minor) Returns true if software with given major and minor version meet minimal version requirements. getDirectoryHandle(%params) Returns an open file handle on either a command output, or a file. logger a logger object directory the directory to use getFileHandle(%params) Returns an open file handle on either a command output, a file, or a string. logger a logger object command the command to use file the file to use, as an alternative to the command string the string to use, as an alternative to the command getFirstLine(%params) Returns the first line of given command output or given file content, with end of line removed. logger a logger object command the exact command to use file the file to use, as an alternative to the command getAllLines(%params) Returns all the lines of given command output or given file content, with end of line removed. logger a logger object command the exact command to use file the file to use, as an alternative to the command getFirstMatch(%params) Returns the result of applying given pattern on the first matching line of given command output or given file content. pattern a regexp logger a logger object command the exact command to use file the file to use, as an alternative to the command getLastLine(%params) Returns the last line of given command output or given file content. logger a logger object command the exact command to use file the file to use, as an alternative to the command getLinesCount(%params) Returns the number of lines of given command output or given file content. logger a logger object command the exact command to use file the file to use, as an alternative to the command canRun($binary) Returns true if given binary can be executed. canRead($file) Returns true if given file can be read. canLoad($module) Returns true if given perl module can be loaded (and actually loads it). hex2char($value) Returns the value converted to a character if it starts with hexadecimal prefix, the unconverted value otherwise. Eg. 0x41 -> A, 41 -> 41. hex2dec($value) Returns the value converted to a decimal if it starts with hexadecimal prefix, the unconverted value otherwise. Eg. 0x41 -> 65, 41 -> 41. dec2hex($value) Returns the value converted to an hexadecimal if it doesn't start with hexadecimal prefix, the unconverted value otherwise. Eg. 65 -> 0x41, 0x41 -> 0x41. any BLOCK LIST Returns a true value if any item in LIST meets the criterion given through BLOCK. all BLOCK LIST Returns a true value if all items in LIST meet the criterion given through BLOCK. none BLOCK LIST Returns a true value if no item in LIST meets the criterion given through BLOCK. uniq BLOCK LIST Returns a new list by stripping duplicate values in LIST. file2module($string) Converts a perl file name to a perl module name (Foo/Bar.pm -> Foo::Bar) module2file($string) Converts a perl module name to a perl file name ( Foo::Bar -> Foo/Bar.pm) runFunction(%params) Run a function whose name is computed at runtime and return its result. logger a logger object module the function namespace function the function name timeout timeout for function execution load enforce module loading first delay($second) Wait for $second. It uses sleep() or Win32::Sleep() depending on the Operating System. perl v5.14.2 2012-06-25 FusionInventory::Agent::Tools(3pm)
All times are GMT -4. The time now is 12:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy