03-02-2012
Ok !
I know I should post another thread, but I am just curious.
What is wrong in my previous command, if I just want to remove space in a particular field only (let' say I am not interested in finding a pattern)
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hi,
let's say $numbers = "324 350 587" an so on...
what i'm trying to do is this:
awk -v numbers="$numbers" '{if (numbers ~ /$2/) print $0, "bla bla"}' file
# file looks like this:
214 .....
215 ...
216 ....
250
...
324
325
...
350 something ...
...
587 ... (4 Replies)
Discussion started by: someone123
4 Replies
2. Shell Programming and Scripting
Hi All,
I would like my code to be able to print out the whole line if 1st field has a dot in the number. Sample input and expected output given below.
My AWK code is below but it can;t work, can any expert help me ?
Thanks in advance.
{if ($1 ~ /*\.*/) { print $0 }}
Input:
... (2 Replies)
Discussion started by: Raynon
2 Replies
3. Shell Programming and Scripting
How can i awk/sed to print the last line of an recurring pattern on the 3rd field?
Input lines:
123456.1 12 1357911 11111.1 01
123456.2 12 1357911 11111.2 02
123456.3 12 1357911 11111.3 03
123456.4 12 1357911 11111.4 04
123456.5 12 1357911 11111.5 05
246810.1 12 1357911 22222.1 01... (4 Replies)
Discussion started by: ux4me
4 Replies
4. Shell Programming and Scripting
First, thanks for the help in previous posts... couldn't have gotten where I am now without it!
So here is what I have, I use AWK to match $1 and $2 as 1 string in file1 to $1 and $2 as 1 string in file2. Now I'm wondering if I can extend this AWK command to incorporate the following:
If $1... (4 Replies)
Discussion started by: right_coaster
4 Replies
5. Shell Programming and Scripting
Hi,
I am trying with the below Perl command to print the first field when the second field matches the given pattern:
perl -lane 'open F, "< myfile"; for $i (<F>) {chomp $i; if ($F =~ /patt$/) {my $f = (split(" ", $i)); print "$f";}} close F' dummy_file
I know I can achieve the same with the... (7 Replies)
Discussion started by: royalibrahim
7 Replies
6. UNIX for Dummies Questions & Answers
Hi experts , im new to Unix,AWK ,and im just not able to get this right.
I need to match for some patterns if it matches I need to print the next few words to it.. I have only three such conditions to match… But I need to print only those words that comes after satisfying the first condition..... (2 Replies)
Discussion started by: 100bees
2 Replies
7. Shell Programming and Scripting
Hi all,
I am new to using awk and am quickly discovering what a powerful pattern-recognition tool it is. However, I have what seems like a fairly basic task that I just can't figure out how to perform in one line. I want awk to find and print all the lines in which one of multiple patterns (e.g.... (8 Replies)
Discussion started by: elgo4
8 Replies
8. Shell Programming and Scripting
Hello,
I have a text file in the below format:
Source Destination State Lag Status
CQA02W2K12pl:D:\CAQA ... (10 Replies)
Discussion started by: pocodot
10 Replies
9. Shell Programming and Scripting
data:
hello--hello1--hello2--#growncars#vello--hello3--hello4--jello#growncars#dello--gello--gelloA--gelloB#growncars#
I want to be able to print all the values that are found between the patterns "#growncars#" and the next "#growncars#" on the same line.
so the output should be:
... (8 Replies)
Discussion started by: SkySmart
8 Replies
10. Shell Programming and Scripting
Hi All,
Greetings!
I have a file of 40000+ lines with different entries, I need matching entries filterd out to their files based on first filed pattern for the matching :
For example:
All server1 entries (in field1) to come together with its path in 2nd field.
The best output I want... (9 Replies)
Discussion started by: rveri
9 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)