Sponsored Content
Top Forums Shell Programming and Scripting Print strings that match pattern with awk Post 302712445 by black_fender on Tuesday 9th of October 2012 07:51:16 AM
Old 10-09-2012
Print strings that match pattern with awk

I have a file with many lines which contain strings like [46ms] [986976ms] .. etc.
But with no rule regarding field separators or anything else.
I want to print ONLY THE STRING from each line , not the entire line !!!

For example from the lines :
Code:
Flow [login] on service [credentialService] executed with success in [46ms]. Performances are []
[] Flow [login] on service [exposerService] executed with success in [6406ms]. Performances are [] 
Flow [logout] on [service] [credentialService] executed with error in [34512ms]. Performances are [] and []

I want to have the output :
Code:
[46ms]
[6406ms]
[34512ms]

Or even better only the numbers from each of these strings. I want it with awk because I need speed, I have very big files to work with.

thanks!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Use to awk to match pattern, and print the pattern

Hi, I know how to use awk to search some expressions like five consecutive numbers, , this is easy. However, how do I make awk print the pattern that is been matched? For example: input: usa,canada99292,japan222,france59664,egypt223 output:99292,59664 (6 Replies)
Discussion started by: grossgermany
6 Replies

2. Shell Programming and Scripting

AWK, print no of records after pattern match.

Hi ALL :). i have a file, cat 3 + dog 5 + rat 6 - i want to print no of record having pattern "+". thanks in advance :confused:. (2 Replies)
Discussion started by: admax
2 Replies

3. Shell Programming and Scripting

Need one liner to search pattern and print everything expect 6 lines from where pattern match made

i need to search for a pattern from a big file and print everything expect the next 6 lines from where the pattern match was made. (8 Replies)
Discussion started by: chidori
8 Replies

4. Shell Programming and Scripting

awk strings search + print next column after match

Hi, I have a file filled with search strings which have a blank in between and look like this: S. g. Ehr. o. Jg. v. d. Chijs g. Ehr. Now i would like to search for the strings and it also shall return the next column after the match. awk -v FILE="search_strings.txt" 'BEGIN {... (10 Replies)
Discussion started by: sdf
10 Replies

5. Shell Programming and Scripting

awk Help: Horizontal to Vertical print with pattern match

Hi AWK Experts, Following is the data : BRH113 DD AA HH CA DD DD AA HH BRH091 A4 A6 AH H7 67 HH J8 9J BRH0991 AA D8 C23 V5 H7 BR2 BRH991 AA HH GG5 BT0 JJ0 I want the output to be alligned with the pattern matching "BRH" inthe line. The output should be look like: A]... (4 Replies)
Discussion started by: rveri
4 Replies

6. Shell Programming and Scripting

awk print pattern match line and following lines

Data: Pattern Data Data Data Data Data Data Data Data Data ... With awk, how do I print the pattern matching line, then the subsequent lines following the pattern matching line. Varying number of lines following the pattern matching line. (9 Replies)
Discussion started by: dmesserly
9 Replies

7. UNIX for Dummies Questions & Answers

Match Pattern after certain pattern and Print words next to Pattern

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

8. Shell Programming and Scripting

Match pattern and print the line number of occurence using awk

Hi, I have a simple problem but i guess stupid enough to figure it out. i have thousands rows of data. and i need to find match patterns of two columns and print the number of rows. for example: inputfile abd abp 123 abc abc 325 ndc ndc 451 mjk lkj... (3 Replies)
Discussion started by: redse171
3 Replies

9. Shell Programming and Scripting

Match Pattern and print pattern and multiple lines into one line

Hello Experts , require help . See below output: File inputs ------------------------------------------ Server Host = mike id rl images allocated last updated density vimages expiration last read <------- STATUS ------->... (4 Replies)
Discussion started by: tigerhills
4 Replies

10. UNIX for Beginners Questions & Answers

Match Strings between two files, print portions of each file together when matched ([g]awk)

I have two files and desire to use the strings from $1 of file 1 (file1.txt) as search criteria to find matches in $2 of file 2 (file2.txt). If matches are found I want to output the entire line of file 2 (file2.txt) followed by fields $2-$11 of file 1 (file1.txt). I can find the matches, I cannot... (7 Replies)
Discussion started by: jvoot
7 Replies
Text::Flow::Wrap(3pm)					User Contributed Perl Documentation				     Text::Flow::Wrap(3pm)

NAME
Text::Flow::Wrap - Flexible word wrapping for not just ASCII output. SYNOPSIS
use Text::Flow::Wrap; # for regular ASCII usage ... my $wrapper = Text::Flow::Wrap->new( check_width => sub { length($_[0]) < 70 }, ); # for non-ASCII usage ... my $wrapper = Text::Flow::Wrap->new( check_width => sub { $pdf->get_text_width($_[0]) < 500 }, ); my $text = $wrapper->wrap($text); DESCRIPTION
The main purpose of this module is to provide text wrapping features without being tied down to ASCII based output and fixed-width fonts. My needs were for sophisticated test control in PDF and GIF output formats in particular. METHODS
new (%params) This constructs a new Text::Flow::Wrap module whose %params set the values of the attributes listed below. wrap ($text) This method will accept a bunch of text, it will then return a new string which is wrapped to the expected width. Attribute Accessors check_width (&code) This attribute is required, and must be a CODE reference. This will be used to determine if the width of the text is appropriate. It will get as an argument, a string which is should check the width of. It should return a Boolean value, true if the string is not exceeded the max width and false if it has. line_break ($str) This is the line break character used when assembling and disassembling the text, it defaults to the newline character " ". paragraph_boundry ($str) This is the paragraph boundry marker used when disassembling the text, it defaults to the string " ". paragraph_break ($str) This is the paragraph breaker used when re-assembling the text, it defaults to the string " ". word_boundry ($str) This is the word boundry marker used when disassembling the text, it defaults to a single space character. word_break ($str) This is the paragraph breaker used when re-assembling the text, it defaults to a single space character. Paragraph Disassembling These methods deal with breaking up the paragraphs into its parts, which can then be processed through the re-assembling methods. These methods are mostly used internally, but more sophisticated tools might need to access them as well (see Text::Flow). disassemble_paragraph disassemble_paragraphs Paragraph Reassembling These methods deal with putting the paragraph parts back together after the disassembling methods have done thier work. These methods are mostly used internally, but more sophisticated tools might need to access them as well (see Text::Flow) reassemble_paragraph reassemble_paragraphs Introspection meta Returns the Moose meta object associated with this class. BUGS
All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or add the bug to cpan-RT. AUTHOR
Stevan Little <stevan@iinteractive.com> COPYRIGHT AND LICENSE
Copyright 2007 by Infinity Interactive, Inc. <http://www.iinteractive.com> This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2007-05-21 Text::Flow::Wrap(3pm)
All times are GMT -4. The time now is 12:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy