Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Generation of Regex for Perl script Post 303036002 by utkarshkhanna44 on Wednesday 12th of June 2019 06:59:47 AM
Old 06-12-2019
Generation of Regex for Perl script and delete

I want to generate regex for this kind of expression and want to find and replace.

like :
----> [-reset, enable;+-]


basically i want to find anything that match a pattern like this [-any string with or without space-] and remove the whole thing
Please looking for some suggestions

Last edited by utkarshkhanna44; 06-12-2019 at 08:35 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Converting perl regex to sed regex

I am having trouble parsing rpm filenames in a shell script.. I found a snippet of perl code that will perform the task but I really don't have time to rewrite the entire script in perl. I cannot for the life of me convert this code into something sed-friendly: if ($rpm =~ /(*)-(*)-(*)\.(.*)/)... (1 Reply)
Discussion started by: suntzu
1 Replies

2. Shell Programming and Scripting

shell or perl script using grep and regex

Hi, I have file stored in a directory containing information about subnet mask and next hop address in the following format 10.1.1.0/16, 255.255.0.0, 10.1.1.1 10.1.2.0/16, 255.255.0.0,10.1.2.1 here 10.1.1.0/16 represent range of ip address 10.1.1.1-10.1.1.16 given say an IP address... (1 Reply)
Discussion started by: termeric
1 Replies

3. Shell Programming and Scripting

Table / Boxes Generation in PERL

Hi all, I was wondering, if there is any way to generate boxes/tables using perl to represent some data in better format. input : Name SAlary pranav 10000 ajay 5000 shri 15000 output : _________________________ |Name |Salary |... (3 Replies)
Discussion started by: PranavEcstasy
3 Replies

4. Programming

Perl regex

HI, I'm new to perl and need simple regex for reading a file using my perl script. The text file reads as - filename=/pot/uio/current/myremificates.txt certificates=/pot/uio/current/userdir/conf/user/gamma/settings/security/... (3 Replies)
Discussion started by: jhamaks
3 Replies

5. Shell Programming and Scripting

Report generation using perl script

Hi, I have a perl script to read the log file and create a report from it. I have the script file and log file in a different directories. Now i have pipe the log file data to the perl script to create the report (HMTL file). I am using the below command this isn't working tail -f... (4 Replies)
Discussion started by: vel4ever
4 Replies

6. Programming

Perl regex

Hello, I'm trying to get a quick help on regex since i'm not a regular programmer. Below is the line i'm trying to apply my regex to..i want to use the regex in a for loop and this line will keep on changing. subject=... (4 Replies)
Discussion started by: jhamaks
4 Replies

7. Programming

Perl regex

Hello folks, Looking for a quick help on regex in my perl script. here's the string i want to parse and get the 2nd field out of it. $str = " 2013-08-07 12:29 Beta ACTIVE"; I want to extract 'Beta' out of this string. This string will keep on changing... (2 Replies)
Discussion started by: jhamaks
2 Replies

8. Shell Programming and Scripting

?= in perl regex

Could anyone please make me understand how the ?= works below .. After executing this I am getting the same output. $string="I love chocolate."; $string =~ s/chocolate(?= ice)/vanilla/; print "$string\n"; (2 Replies)
Discussion started by: scriptscript
2 Replies

9. Shell Programming and Scripting

Perl, RegEx - Help me to understand the regex!

I am not a big expert in regex and have just little understanding of that language. Could you help me to understand the regular Perl expression: ^(?!if\b|else\b|while\b|)(?:+?\s+){1,6}(+\s*)\(*\) *?(?:^*;?+){0,10}\{ ------ This is regex to select functions from a C/C++ source and defined in... (2 Replies)
Discussion started by: alex_5161
2 Replies

10. UNIX for Beginners Questions & Answers

Help with understanding this regex in a Perl script parsing a 'complex' string

Hi, I need some guidance with understanding this Perl script below. I am not the author of the script and the author has not leave any documentation. I supposed it is meant to be 'easy' if you're a Perl or regex guru. I am having problem understanding what regex to use :confused: The script does... (3 Replies)
Discussion started by: newbie_01
3 Replies
DateTime::Format::Builder::Parser::Regex(3pm)		User Contributed Perl Documentation	     DateTime::Format::Builder::Parser::Regex(3pm)

NAME
DateTime::Format::Builder::Parser::Regex - Regex based date parsing SYNOPSIS
my $parser = DateTime::Format::Builder->create_parser( regex => qr/^(dddd)(dd)(dd)T(dd)(dd)(dd)$/, params => [ qw( year month day hour minute second ) ], ); SPECIFICATION
In addition to the common keys, "Regex" supports: o regex is a regular expression that should capture elements of the datetime string. This is a required element. This is the key whose presence indicates it's a specification that belongs to this class. o params is an arrayref of key names. The captures from the regex are mapped to these ($1 to the first element, $2 to the second, and so on) and handed to "DateTime->new()". This is a required element. o extra is a hashref of extra arguments you wish to give to "DateTime->new()". For example, you could set the "year" or "time_zone" to defaults: extra => { year => 2004, time_zone => "Australia/Sydney" }, o constructor is either an arrayref or a coderef. If an arrayref then the first element is a class name or object, and the second element is a method name (or coderef since Perl allows that sort of thing). The arguments to the call are anything in $p and anything given in the "extra" option above. If only a coderef is supplied, then it is called with arguments of $self, $p and "extra". In short: $self->$coderef( %$p, %{ $self->{extra} } ); The method is expected to return a valid DateTime object, or undef in event of failure, but can conceivably return anything it likes. So long as it's 'true'. THANKS
See the main module's section. SUPPORT
Support for this module is provided via the datetime@perl.org email list. See http://lists.perl.org/ for more details. Alternatively, log them via the CPAN RT system via the web or email: http://perl.dellah.org/rt/dtbuilder bug-datetime-format-builder@rt.cpan.org This makes it much easier for me to track things and thus means your problem is less likely to be neglected. LICENCE AND COPYRIGHT
Copyright X Iain Truskett, 2003. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.000 or, at your option, any later version of Perl 5 you may have available. The full text of the licences can be found in the Artistic and COPYING files included with this module, or in perlartistic and perlgpl as supplied with Perl 5.8.1 and later. AUTHOR
Iain Truskett <spoon@cpan.org> SEE ALSO
"datetime@perl.org" mailing list. http://datetime.perl.org/ perl, DateTime, DateTime::Format::Builder perl v5.10.1 2010-03-14 DateTime::Format::Builder::Parser::Regex(3pm)
All times are GMT -4. The time now is 11:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy