Sponsored Content
Full Discussion: awk to grep log
Top Forums Shell Programming and Scripting awk to grep log Post 302927562 by justbow on Thursday 4th of December 2014 03:23:33 AM
Old 12-04-2014
awk to grep log

hi expert,

i Have log like :

Code:
dn: EPC-Per=673,HYHGU
objectClass: EPC-PerSubs
ownerId: 0
groupId: 4001
shareTree: nodeName=HYHGU
permissions: 15
EPC-Per: 673

dn: EPC-SessionId=54454C2D5341534E2D342D302E736170632E64737467726F75702E636F6D3B313430343834313237333B323638343336363430,EPC-Per=673,HYHGU
shareTree: nodeName=HYHGU
permissions: 15
EPC-SessionId: 54454C2D5341534E2D342D302E736170632E64737467726F75702E636F6D3B313430343834313237333B323638343336363430

dn: EPC-SessionId=4453542D5341534E2D342D302E736170632E64737467726F75702E636F6D3B313430353936323432333B323638343336373530,EPC-Per=673,HYHGU
shareTree: nodeName=HYHGU
permissions: 15
EPC-SessionId: 4453542D5341534E2D342D302E736170632E64737467726F75702E636F6D3B313430353936323432333B323638343336373530

dn: EPC-SessionId=54454C2D5341534E2D332D302E736170632E64737467726F75702E636F6D3B313431373635393130323B333031373437343436,EPC-Per=673,HYHGU
shareTree: nodeName=HYHGU
permissions: 15
EPC-SessionId: 54454C2D5341534E2D332D302E736170632E64737467726F75702E636F6D3B313431373635393130323B333031373437343436
EPC-IpAddress: 10.186.22.49
EPC-CalledStationId: internet
EPC-LastActivityTimeStamp: 04-12-2014T16:01:44

dn: EPC-SessionId=54454C2D5341534E2D302D302E736170632E64737467726F75702E636F6D3B313431373634333338393B393436343937313332,EPC-Per=673,HYHGU
shareTree: nodeName=HYHGU
permissions: 15
EPC-SessionId: 54454C2D5341534E2D302D302E736170632E64737467726F75702E636F6D3B313431373634333338393B393436343937313332
EPC-IpAddress: 10.186.173.102
EPC-CalledStationId: internet
EPC-LastActivityTimeStamp: 04-12-2014T13:04:51

i want to print dn session if dont have EPC-IpAdress

so output will be like this :

Code:
EPC-SessionId=54454C2D5341534E2D342D302E736170632E64737467726F75702E636F6D3B313430343834313237333B323638343336363430,EPC-Per=673,HYHGU
EPC-SessionId=4453542D5341534E2D342D302E736170632E64737467726F75702E636F6D3B313430353936323432333B323638343336373530,EPC-Per=673,HYHGU

Thanks
Justbow
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Constantly updating log files (tail -f? grep? awk?)

I have a log file which is continuously added to, called log.file. I'd like to monitor this file, and when certain lines are found, update some totals in another file. I've played around with tail -f, grep, and awk, but can't seem to hit the right note, so to speak. The lines I'm... (0 Replies)
Discussion started by: nortonloaf
0 Replies

2. UNIX for Advanced & Expert Users

WEB Server Log File Analysis using awk/sed/grep

I'm trying to find a way to show large page sizes (page size in K) from multiple web server log files. Essentially I want to show only rows from a file where a specific column is larger than some value. Has anyone ever done this type of log analysis? If so, a snippet of code would be very... (2 Replies)
Discussion started by: mike_cataldo@ad
2 Replies

3. Shell Programming and Scripting

MEM=`ps v $PPID| grep -i db2 | grep -v grep| awk '{ if ( $7 ~ " " ) { print 0 } else

Hi Guys, I need to set the value of $7 to zero in case $7 is NULL. I've tried the below command but doesn't work. Any ideas. thanks guys. MEM=`ps v $PPID| grep -i db2 | grep -v grep| awk '{ if ( $7 ~ " " ) { print 0 } else { print $7}}' ` Harby. (4 Replies)
Discussion started by: hariza
4 Replies

4. Shell Programming and Scripting

Read content between xml tags with awk, grep, awk or what ever...

Hello, I trying to extract text that is surrounded by xml-tags. I tried this cat tst.xml | egrep "<SERVER>.*</SERVER>" |sed -e "s/<SERVER>\(.*\)<\/SERVER>/\1/"|tr "|" " " which works perfect, if the start-tag and the end-tag are in the same line, e.g.: <tag1>Hello Linux-Users</tag1> ... (5 Replies)
Discussion started by: Sebi0815
5 Replies

5. Shell Programming and Scripting

Parsing out access.log with awk and grep

In part of my script I use awk to pull out the urls. awk '{print $8}' then I take them and send them to grep.` Some of them are straight .com/ or .org or whatever (address bar entries), while others are locations of images, js, etc. I'm trying to only pull any line that ends with .com/... (11 Replies)
Discussion started by: druisgod
11 Replies

6. Shell Programming and Scripting

Use grep sed or awk to extract string from log file and put into CSV

I'd like to copy strings from a log file and put them into a CSV. The strings could be on different line numbers, depending on size of log. Example Log File: File = foo.bat Date = 11/11/11 User = Foo Bar Size = 1024 ... CSV should look like: "foo.bat","11/11/11","Foo Bar","1024" (7 Replies)
Discussion started by: chipperuga
7 Replies

7. Shell Programming and Scripting

Router ping log extract data from it Awk/Sed/grep

Hi, I am new to this world.. Using expect i loging to router and checking ping response to my links. I need to genarate report using this output and that report contains only three file link name, packet loss, latency. my output of script is like below: -bash-3.00$ monmw/mwbkp... (2 Replies)
Discussion started by: jkmistry
2 Replies

8. Shell Programming and Scripting

AWK/GREP: grep only lines starting with integer

I have an input file 12.4 1.72849432773174e+01 -7.74784188610632e+01 12.5 9.59432114416327e-01 -7.87018212757537e+01 15.6 5.20139995965960e-01 -5.61612429666624e+01 29.3 3.76696387248366e+00 -7.42896194101892e+01 32.1 1.86899877018077e+01 -7.56508762501408e+01 35 6.98857157014640e+00... (2 Replies)
Discussion started by: chrisjorg
2 Replies

9. UNIX for Dummies Questions & Answers

Piping grep into awk, read the next line using grep

Hi, I have a number of files containing the information below. """"" Fundallinfo 6.3950 14.9715 14.0482 """"" I would like to grep for Fundallinfo and use it to read the next line? I ideally would like to read the three numbers that follow in the next line and... (2 Replies)
Discussion started by: Paul Moghadam
2 Replies

10. Shell Programming and Scripting

sed / awk / grep to extract information from log

Hi all, I have a query that runs that outputs data in the following format - 01/09/12 11:43:40,ADMIN,4,77,Application Group Load: Name(TESTED) LoadId(5137-1-0-1XX-15343-15343) File(/dir/dir/File.T03.CI2.RYR.2012009.11433350806.ARD) InputSize(5344) OutputSize(1359) Rows(2) Time(1.9960)... (8 Replies)
Discussion started by: jeffs42885
8 Replies
XML::LibXML::Namespace(3)				User Contributed Perl Documentation				 XML::LibXML::Namespace(3)

NAME
XML::LibXML::Namespace - XML::LibXML Namespace Implementation SYNOPSIS
use XML::LibXML; # Only methods specific to Namespace nodes are listed here, # see XML::LibXML::Node manpage for other methods my $ns = XML::LibXML::Namespace->new($nsURI); print $ns->nodeName(); print $ns->name(); $localname = $ns->getLocalName(); print $ns->getData(); print $ns->getValue(); print $ns->value(); $known_uri = $ns->getNamespaceURI(); $known_prefix = $ns->getPrefix(); DESCRIPTION
Namespace nodes are returned by both $element->findnodes('namespace::foo') or by $node->getNamespaces(). The namespace node API is not part of any current DOM API, and so it is quite minimal. It should be noted that namespace nodes are not a sub class of XML::LibXML::Node, however Namespace nodes act a lot like attribute nodes, and similarly named methods will return what you would expect if you treated the namespace node as an attribute. Note that in order to fix several inconsistencies between the API and the documentation, the behavior of some functions have been changed in 1.64. METHODS
new my $ns = XML::LibXML::Namespace->new($nsURI); Creates a new Namespace node. Note that this is not a 'node' as an attribute or an element node. Therefore you can't do call all XML::LibXML::Node Functions. All functions available for this node are listed below. Optionally you can pass the prefix to the namespace constructor. If this second parameter is omitted you will create a so called default namespace. Note, the newly created namespace is not bound to any document or node, therefore you should not expect it to be available in an existing document. declaredURI Returns the URI for this namespace. declaredPrefix Returns the prefix for this namespace. nodeName print $ns->nodeName(); Returns "xmlns:prefix", where prefix is the prefix for this namespace. name print $ns->name(); Alias for nodeName() getLocalName $localname = $ns->getLocalName(); Returns the local name of this node as if it were an attribute, that is, the prefix associated with the namespace. getData print $ns->getData(); Returns the URI of the namespace, i.e. the value of this node as if it were an attribute. getValue print $ns->getValue(); Alias for getData() value print $ns->value(); Alias for getData() getNamespaceURI $known_uri = $ns->getNamespaceURI(); Returns the string "http://www.w3.org/2000/xmlns/" getPrefix $known_prefix = $ns->getPrefix(); Returns the string "xmlns" AUTHORS
Matt Sergeant, Christian Glahn, Petr Pajas VERSION
2.0008 COPYRIGHT
2001-2007, AxKit.com Ltd. 2002-2006, Christian Glahn. 2006-2009, Petr Pajas. perl v5.16.2 2012-10-22 XML::LibXML::Namespace(3)
All times are GMT -4. The time now is 03:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy