Hello Experts,
Can someone help me here:
I have a variable which contains a string with "".
set var1 {a}
set str1 {a is the element i want to match}
Now "regexp $var1 $str1" does not work?
("regexp {a\} $str1" works, but var1 gets it's value automatically from another script)
Is... (6 Replies)
Couldn't find much help on the kind of question I've here:
There is this text file with text as:
Line one has a bingo
Line two does not have a bingo but it has a tango
Bingo is on line three
Line four has both tango and bingo
Now I would want to search for the pattern "bingo" in this file... (3 Replies)
Hi all Unix Gurus!
Since hours (even days :-)) I'm trying to find the correct pattern to search for IP addesses in text files.
The pattern to find a IP address itself is not too difficult:
'((||1{2}|2|2{2})\.){3,}(||1{2}|2|2{2})'
BUT, of course the above pattern is also matching lines like... (9 Replies)
Hi Experts,
I want to delete all the files in a folder other than files with .zip extension using shell script.
please suggest the code.
Neeraj Chourasiya (3 Replies)
Hello everyone,
I'm new in tcl scripting.
I'm currently studying a tcl script and came across this line:
regexp {(\d+)(\S?)} $opts match opt swi
According to my understanding, this line means to search in the opts variable for one or more digit, followed by a non-whitespace character... (2 Replies)
I need some help with regexp in tcl. The following code does work if the $urlvar ends in jpg,jpeg,png or gif. Eg, protocol(http/https)://testsite.com/images/image1.jpg
if { ! } {
//Do something
}
My problem is that if the URL does not end in these extensions this regexp is of no... (1 Reply)
I need to change R3.1.5 as 03015
similarly R4.1.7 as 04017
i need a single command
in tcl pls help
---------- Post updated at 05:19 PM ---------- Previous update was at 04:48 PM ----------
i had to do like this without using regexp
set old_release "R3.1.5"
... (1 Reply)
In a tcl script I need to find a way of reading a file, and looking for a phrase ("set myvariable") and putting the word following that into a variable.
I've used a file open, and a while loop with gets to read each line from the file into a variable, and using regexp searched for the item. I'm... (1 Reply)
How to use regexp to print out repetitive pattern in awk?
$ awk '{print $0, "-\t-\t-\t-\t-\t-\t-\t-\t-\t-\t-\t-"}' output:
- - - - - - - - - - - -I tried following which does not give what I want, of course.
awk '{print $0, "-\t{11}-"}'
output:
- ... (10 Replies)
Hi Guys ,
I am having a file as stated below
File 1
sa0 -- i_core/i_core_apb/i_afe0_controller/U261/A
sa0 -- i_core/i_core_apb/i_afe0_controller/U265/Z
sa1 -- i_core/i_core_apb/i_afe0_controller/U265/A
sa1 -- i_core/i_core_apb/i_afe0_controller/U268/Z
sa1 -- ... (7 Replies)
Discussion started by: kshitij
7 Replies
LEARN ABOUT DEBIAN
regexp-assemble
REGEXP-ASSEMBLE(1p) User Contributed Perl Documentation REGEXP-ASSEMBLE(1p)NAME
regexp-assemble - Assemble a list of regular expressions from a file
SYNOPSIS
regexp-assemble -abcdfinprsStTuUvw file [...]
DESCRIPTION
Assemble a list of regular expression either from standard input or a file, using the Regexp::Assemble module.
OPTIONS -a look Ahead. Insert "(?=...)" zero-width lookahead assertions in the pattern, where necessary.
-b Blank. Ignore blank lines.
-c Comment. Basic comment filtering. Strip off perl/shell comments ("s*#.*$/").
-d Debug. Turns on debugging output. See Regexp::Assemble for suitable values.
-i Indent. Print the regular expression using and indent of n to display nesting. A.k.a pretty-printing. Implies -p.
-n No newline. Do not print a newline after the pattern. Useful when interpolating the output into a templating system or similar.
-p Print. Print the pattern. This is the default, however, it is required when the -t switch is enabled (because if you want to test
patterns ordinarily you don't care what the the assembled pattern looks like).
-r Reduce. The default behaviour is to reduce the assembled pattern. Enabling this switch causes the reduction algorithm to be switched
off. This can help you determine how much reduction is performed.
regexp-assemble pattern.file | wc
# versus
regexp-assemble -r pattern.file | wc
-s Statistics. Print some statistics about the assembled pattern. The output is sent to STDERR (in order to allow the generated pattern
to be redirected elsewhere).
-S Statistics only. Like -s, except that the pattern itself is not output. Useful with -d 8 to see the time taken.
-t Test. Test the assembled expression against the contents of a file. Each line is read from the file and is matched against the
pattern. Lines that fail to match are printed. In other words, no output is good output. In this mode of operation, error status is 1
in the case of a failure, 0 if all lines matched.
-T Time. Print statistics on the time taken to reduce and assemble the pattern. (This is merely a lazy person's synonym for "-d 8").
-u Unique. Carp if duplicate patterns are found.
-U Unroll. Transform "a+" et al into "aa*" (which may allow additional reductions).
-v Version. Print the version of the regexp-assemble script.
-w Word/Whole. When testing the contents of a file with "-t", bracket the expression with "^" and "$" in order to match the whole word or
line from the file.
DIAGNOSTICS
Will print out a summary of the problem if an added pattern causes the assembly to fail.
SEE ALSO
Regexp::Assemble
AUTHOR
Copyright (C) 2004-2008 David Landgren. All rights reserved.
LICENSE
This script is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2012-06-30 REGEXP-ASSEMBLE(1p)