Hi All,
I have an input below. I tried to use the awk below but it seems that it ;s not working. Can anybody help ?
My concept here is to find the 2nd field of the last occurrence of such pattern " ** XXX ccc ccc cc cc ccc 2007 " . In this case, the 2nd field is " XXX ". With this "XXX" term... (20 Replies)
I want to print between the range two patterns if a particular pattern is present in between the two patterns. I am new to Unix. Any help would be greatly appreciated.
e.g.
Pattern1
Bombay
Calcutta
Delhi
Pattern2
Pattern1
Patna
Madras
Gwalior
Delhi
Pattern2
Pattern1... (2 Replies)
Hi
I have files with names that contain the date in several formats as, YYYYMMDD, DD-MM-YY,DD.MM.YY or similar combinations.
I know if a file fits in one pattern or other, but i donīt know how to extract the substring contained in the file that matches the pattern.
For example, i know that
... (1 Reply)
Hi,
I have a large, multiline log file.
I have used pcregrep to extract all entries in that log that match a particular pattern - where that pattern spans multiple lines.
However, because the log file is large, and these entries occur every few minutes, I still output a very large amount... (6 Replies)
Hi,
I have a test file name test.txt with its contents
string
21345
qwee
strinn
strriin
striin
i need to delete all the words except the word STRING
I used the command
cat test.txt | sed 's/^..*$/**/g'
but the output entries still contain
strinn
strriin
striin.
Plz Help me out.... (5 Replies)
Hello,
I was wondering how is it possible if I use this command:
awk 'NR >= 998 && NR <= 1000' file.txtTo exit after parsing the 1000th line ( last line targeted) ???
I observed that when executing this command for a large file, if the range of lines is at the beginning of the file it is... (2 Replies)
Hi there,
Looking forward to your advice for the below:
I have a file which contains 2 paragraphs related to a particular pattern. I have to search for those paragraphs from a log file and then print a particular line from those paragraphs.
Sample:
I have one file with the fixed... (3 Replies)
To match range, the command is:
awk '/BEGIN/,/END/'
but what I want is the range is printed only if there is additional pattern that matches in the range itself? maybe like this:
awk '/BEGIN/,/END/ if only in that range there is /pattern/'
Thanks (8 Replies)
Hi all,
I have been searching all over Google but I am unable to find a solution for a particular result that I am trying to achieve.
Consider the following input:
1
2
3
4
5
B4Srt1--Variable-0000
B4Srt2--Variable-1111
Srt
6
7
8
9
10
End (3 Replies)
Hi all,
I have file on which I do grep on "/tmp/data" then I get 5 lines as
dir Path: /tmp/data/20162343134
Starting to listen on ports logging:
--
Moving results files from local storage: /tmp/resultsFiles/20162343134/*.gz to NFS: /data/temp/20162343134/outgoing
from above got to get... (7 Replies)
Perl::Critic::Policy::BuiltinFunctions::ProhibitComplexMUsernContributed Perl Perl::Critic::Policy::BuiltinFunctions::ProhibitComplexMappings(3pm)NAME
Perl::Critic::Policy::BuiltinFunctions::ProhibitComplexMappings - Map blocks should have a single statement.
AFFILIATION
This Policy is part of the core Perl::Critic distribution.
DESCRIPTION
The map function can be confusing to novices in the best of circumstances. Mappings with multiple statements are even worse. They're also
a maintainer's nightmare because any added complexity decreases readability precipitously. Why? Because map is traditionally a one-liner
converting one array to another. Trying to cram lots of functionality into a one-liner is a bad idea in general.
The best solutions to a complex mapping are: 1) write a subroutine that performs the manipulation and call that from map; 2) rewrite the
map as a for loop.
CAVEATS
This policy currently misses some compound statements inside of the map. For example, the following code incorrectly does not trigger a
violation:
map { do { foo(); bar() } } @list
CONFIGURATION
By default this policy flags any mappings with more than one statement. While we do not recommend it, you can increase this limit as
follows in a .perlcriticrc file:
[BuiltinFunctions::ProhibitComplexMappings]
max_statements = 2
AUTHOR
Chris Dolan <cdolan@cpan.org>
CREDITS
Initial development of this policy was supported by a grant from the Perl Foundation.
COPYRIGHT
Copyright (c) 2007-2011 Chris Dolan.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.14.22012-06-07Perl::Critic::Policy::BuiltinFunctions::ProhibitComplexMappings(3pm)