Sponsored Content
Top Forums Shell Programming and Scripting sed - print only matching regex Post 302315048 by domi55 on Monday 11th of May 2009 10:45:59 AM
Old 05-11-2009
OMG. Thanks so much guys.

But unfortunately I prefere awk Smilie

@ jim mcnamara:

How can I just print out four (4) characters.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

pattern matching and print with sed

Hi It is possible with sed to print a pattern within a line matching regexp? So, the line looks like : 19:00:00 blablablabla jobid 2345 <2> the regexp is "jobid 2345" and the pattern is 56434. That the code for find... (2 Replies)
Discussion started by: nymus7
2 Replies

2. Shell Programming and Scripting

Regex/sed - matching any char,space,underscore between : and /

trying to remove the portion in red: Data: mds_ar/bin/uedw92wp.ksh: $AI_SQL/wkly.sql mds_ar/bin/uedw92wp.ksh: $EDW_TMP/wkly.sql output to be: mds_ar/bin/uedw92wp.ksh: wkly.sql mds_ar/bin/uedw92wp.ksh: wkly.sql SED i'm trying to use: sed 's/:+\//: /g' input_file.dat >... (11 Replies)
Discussion started by: danmauer
11 Replies

3. Shell Programming and Scripting

print first few lines, then apply regex on a specific column to print results.

abc.dat tty cpu tin tout us sy wt id 0 0 7 3 19 71 extended device statistics r/s w/s kr/s kw/s wait actv wsvc_t asvc_t %w %b device 0.0 133.2 0.0 682.9 0.0 1.0 0.0 7.2 0 79 c1t0d0 0.2 180.4 0.1 5471.2 3.0 2.8 16.4 15.6 15 52 aaaaaa1-xx I want to skip first 5 line... (4 Replies)
Discussion started by: kchinnam
4 Replies

4. UNIX for Dummies Questions & Answers

sed print certain lines matching variable

I have a very large results file, and a list of filters grep -wf filterlist.txt datafile.txt > outfile.txt The above line works but is very slow and I'm wondering how to make it faster. The items in my filterlist are only relevant to the first column. I don't care if any item in the... (1 Reply)
Discussion started by: sayb
1 Replies

5. UNIX for Dummies Questions & Answers

sed print matching pattern

Hi, i have data file like: START1 a b STOP c d START2 e STOP f START3 g STOP When one of the START<count> variable is passed, i should print all lines matching this until the first 'STOP' for example if 'START2' is provided for match, i should get the result as: START2 (1 Reply)
Discussion started by: ysrini
1 Replies

6. Shell Programming and Scripting

SED: Pattern repitition regex matching

Fairly straightforward, but I'm having an awful time getting what I thought was a simple regex to work. I'll give the command I was playing with, and I'm aware why this one doesn't work (the 1,3 is off the A-Z, not the whole expression), I just don't know what the fix is: Actual Output(s): $... (5 Replies)
Discussion started by: Vryali
5 Replies

7. Shell Programming and Scripting

To print lines between 2 timestamps using awk|sed and regex

Hi, I am using the following code to fetch lines that are generated in last 1 hr . Hence, I am using date function to calculate -last 1 hr & the current hr and then somehow use awk (or sed-if someone could guide me better) with some regex pattern. dt_1=`date +%h" "%d", "%Y\ %l -d "1 hour... (10 Replies)
Discussion started by: sarah-alikhan31
10 Replies

8. UNIX for Advanced & Expert Users

awk print all fields except matching regex

grep -v will exclude matching lines, but I want something that will print all lines but exclude a matching field. The pattern that I want excluded is '/mnt/svn' If there is a better solution than awk I am happy to hear about it, but I would like to see this done in awk as well. I know I can... (11 Replies)
Discussion started by: glev2005
11 Replies

9. Shell Programming and Scripting

Compare file1 for matching line in file2 and print the difference in matching lines

Hello, I have two files file 1 and file 2 each having result of a query on certain database tables and need to compare for Col1 in file1 with Col3 in file2, compare Col2 with Col4 and output the value of Col1 from File1 which is a) not present in Col3 of File2 b) value of Col2 is different from... (2 Replies)
Discussion started by: RasB15
2 Replies

10. UNIX for Advanced & Expert Users

sed REGEX to print multiple occurrences of a pattern from a line

I have a line that I need to parse through and extract a pattern that occurs multiple times in it. Example line: getInfoCall: info received please proceed, getInfoCall: info received please proceed, getInfoCall: info received please proceed, getInfoCall: info received please proceed,... (4 Replies)
Discussion started by: Vidhyaprakash
4 Replies
XML::Filter::Sort::Buffer(3pm)				User Contributed Perl Documentation			    XML::Filter::Sort::Buffer(3pm)

NAME
XML::Filter::Sort::Buffer - Implementation class used by XML::Filter::Sort DESCRIPTION
The documentation is targetted at developers wishing to extend or replace this class. For user documentation, see XML::Filter::Sort. For an overview of the classes and methods used for buffering, see XML::Filter::Sort::BufferMgr. BUFFER LIFE CYCLE
A XML::Filter::Sort::Buffer object is created by a XML::Filter::Sort::BufferMgr object using the "new()" method. The XML::Filter::Sort object will then propagate any SAX events it receives, to the buffer object until the end of the record is reached. As each element is added to the buffer, its contents are compared to the sort key paths and the sort key values are extracted. When the end of the record is reached, the "close()" method is called. The return value from this method is the list of sort keys. The buffer manager will store the buffer until the end of the record sequence is reached. Then it will retrieve each buffer in order of the sort key values and call the buffer's "to_sax()" method to send all buffered events to the downstream handler. Following the call to "to_sax()", the buffer is discarded. No destructor method is used - everything is handled by Perl's garbage collector. DATA STRUCTURES
The buffer contains a 'tree' of SAX events. The tree is simply an array of 'nodes'. Text nodes are represented as scalars. Other nodes are represented as arrayrefs. The first element of a node array is a single character identifying the node type: e - element c - comment p - processing instruction The second element is the node data (the hash from the original SAX event). The child nodes of an element node are represented by the third element as an arrayref. For example, this XML: <person age="27"> <lastname>smith</lastname> </person> Would be buffered as this data structure: [ [ 'e', { 'Name' => 'person' 'Prefix' => '', 'LocalName' => 'person', 'NamespaceURI' => '', 'Attributes' => { '{}age' => { 'LocalName' => 'age', 'NamespaceURI' => '', 'Value' => '27', 'Prefix' => '', 'Name' => 'age' } }, }, [ " ", [ 'e', { 'Name' => 'lastname' 'Prefix' => '', 'LocalName' => 'lastname', 'NamespaceURI' => '', 'Attributes' => {}, }, [ 'smith' ] ], " ", ] ] ] COPYRIGHT
Copyright 2002 Grant McLean <grantm@cpan.org> This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.4 2005-04-20 XML::Filter::Sort::Buffer(3pm)
All times are GMT -4. The time now is 11:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy