---------- Post updated at 03:12 PM ---------- Previous update was at 03:10 PM ----------
I'm not sure whether this logic will work because ^F509 can come anywhere in the file (not $2) .
Ok, adjusted to any field:
---
Quote:
Originally Posted by RudiC
Try
This will fail if there is a line that happens to have the same sequence of numbers before the F509 field. Then sub (m, n++) will substitute those numbers instead of those in the F509 field...
Last edited by Scrutinizer; 11-03-2015 at 12:19 AM..
This User Gave Thanks to Scrutinizer For This Post:
Hi,
I am new to this forum and i would like to get help in this issue.
I have a file 1.txt as shown:
apple
banana
orange
apple
grapes
banana
orange
grapes
orange
....
Now i would like to search for pattern say apple or orange and then put a # at the beginning of the pattern... (2 Replies)
Hi,
I think you ppl did not get my question correctly, let me explain
I have 1.txt with following entries as shown:
0152364|134444|10.20.30.40|015236433
0233654|122555|10.20.30.50|023365433
**
**
**
In file 2.txt I have the following entries as shown:
... (1 Reply)
I am trying to do some thing like this ..
In a file , if pattern found insert new pattern at the begining of the line containing the pattern.
example:
in a file I have this.
gtrow0unit1/gctunit_crrownorth_stage5_outnet_feedthru_pin
if i find feedthru_pin want to insert !! at the... (7 Replies)
Gurus,
I need to run a script on multiple XML files in different directories and do the following (the output can be redirected to create a new file)
1. Search a pattern like "abc.mno.xyz" in an XML file, once detected, the script should delete one line above and 3 lines below (including the... (2 Replies)
I have read another post about this issue and am wondering how to adapt it
to my own, much simpler, issue.
I have a file of user IDs like so:
333333
321321
546465
...etc
I need to take each number and use it to print records wherein the 5th
field matches the user ID pulled from the... (2 Replies)
I couldn't figure out how to use sed or any other shell to do the following. Can anyone help? Thanks.
If seeing a string (e.g., TODAY) in the line,
replace a string in the line above (e.g, replace "Raining" with "Sunny")
and replace a string in the line below (e.g., replace "Reading" with... (7 Replies)
Hi,
I need a shell script, which would search the result values from another files.
1)execute " select column1 from table_name" query on the table.
2)Based on the result, need to be grep from .wft files.
could please explain about this.Below is the way i am using.
#!/bin/sh... (4 Replies)
Hi,
I am trying to write a shell script which will modify existing values and take backup of old values.
file trying to modify is : /etc/sysctl.conf
script name: modify.sh
execute ./modify.sh
enter ref no: 123
add below values in file sysctl.cnf
kernel.shmall = 4194304
... (7 Replies)
I have this fileA
TEST FILE ABC
this file contains ABC;
TEST FILE DGHT this file contains DGHT;
TEST FILE 123
this file contains ABC,
this file contains DEF,
this file contains XYZ,
this file contains KLM
;
I want to have a fileZ that has only (begin search pattern for will be... (2 Replies)
Discussion started by: vbabz
2 Replies
LEARN ABOUT DEBIAN
mojolicious::routes::pattern
Mojolicious::Routes::Pattern(3pm) User Contributed Perl Documentation Mojolicious::Routes::Pattern(3pm)NAME
Mojolicious::Routes::Pattern - Routes pattern engine
SYNOPSIS
use Mojolicious::Routes::Pattern;
# Create pattern
my $pattern = Mojolicious::Routes::Pattern->new('/test/:name');
# Match routes
my $result = $pattern->match('/test/sebastian');
say $result->{name};
DESCRIPTION
Mojolicious::Routes::Pattern is the core of Mojolicious::Routes.
ATTRIBUTES
Mojolicious::Routes::Pattern implements the following attributes.
"defaults"
my $defaults = $pattern->defaults;
$pattern = $pattern->defaults({foo => 'bar'});
Default parameters.
"format"
my $regex = $pattern->format;
$pattern = $pattern->format($regex);
Compiled regex for format matching.
"pattern"
my $pattern = $pattern->pattern;
$pattern = $pattern->pattern('/(foo)/(bar)');
Raw unparsed pattern.
"quote_end"
my $quote = $pattern->quote_end;
$pattern = $pattern->quote_end(']');
Character indicating the end of a quoted placeholder, defaults to ")".
"quote_start"
my $quote = $pattern->quote_start;
$pattern = $pattern->quote_start('[');
Character indicating the start of a quoted placeholder, defaults to "(".
"regex"
my $regex = $pattern->regex;
$pattern = $pattern->regex($regex);
Pattern in compiled regex form.
"relaxed_start"
my $relaxed = $pattern->relaxed_start;
$pattern = $pattern->relaxed_start('*');
Character indicating a relaxed placeholder, defaults to "#".
"reqs"
my $reqs = $pattern->reqs;
$pattern = $pattern->reqs({foo => qr/w+/});
Regex constraints.
"symbol_start"
my $symbol = $pattern->symbol_start;
$pattern = $pattern->symbol_start(':');
Character indicating a placeholder, defaults to ":".
"symbols"
my $symbols = $pattern->symbols;
$pattern = $pattern->symbols(['foo', 'bar']);
Placeholder names.
"tree"
my $tree = $pattern->tree;
$pattern = $pattern->tree([ ... ]);
Pattern in parsed form.
"wildcard_start"
my $wildcard = $pattern->wildcard_start;
$pattern = $pattern->wildcard_start('*');
Character indicating the start of a wildcard placeholder, defaults to "*".
METHODS
Mojolicious::Routes::Pattern inherits all methods from Mojo::Base and implements the following ones.
"new"
my $pattern = Mojolicious::Routes::Pattern->new('/:action');
my $pattern
= Mojolicious::Routes::Pattern->new('/:action', action => qr/w+/);
my $pattern = Mojolicious::Routes::Pattern->new(format => 0);
Construct a new pattern object.
"match"
my $result = $pattern->match('/foo/bar');
my $result = $pattern->match('/foo/bar', 1);
Match pattern against entire path, format detection is disabled by default.
"parse"
$pattern = $pattern->parse('/:action');
$pattern = $pattern->parse('/:action', action => qr/w+/);
$pattern = $pattern->parse(format => 0);
Parse a raw pattern.
"render"
my $path = $pattern->render({action => 'foo'});
my $path = $pattern->render({action => 'foo'}, 1);
Render pattern into a path with parameters, format rendering is disabled by default.
"shape_match"
my $result = $pattern->shape_match($path);
my $result = $pattern->shape_match($path, 1);
Match pattern against path and remove matching parts, format detection is disabled by default.
SEE ALSO
Mojolicious, Mojolicious::Guides, <http://mojolicio.us>.
perl v5.14.2 2012-09-05 Mojolicious::Routes::Pattern(3pm)