regex - How to append the lines using SED or AWK until a particular pattern does not matches? -


I want to add a line that does not start with given pattern but I Unable to do that Plz helps me solve this problem by using sed or awk by using sed . For example:

INPUT:

  18:55:42 [pool-1-thread-2] info jfileupload.download.http A - Downloaded Complete 18:55:42 [HTTPDOWNLOAD] Error jfileupload.download.ui.DownloadTransferUI - java.io.IOException: File: URL I show failed in / home / he / desktop sun.awt.X11 on java.awt.Desktop.open (Desktop.java:272) on .launch jfileupload.download.ui.DownloadTransferUI on / sun.awt.X11.XDesktopPeer. On XDesktopPeer.open (XDesktopPeer.java:77) (XDesktopPeer.java:114). In java.lang.Thread.run (Thread.java:745) on JfileuploadkdownloadkhttpkHTTPDownloadTransferka (unknown source Jfileuploadkdownloadkaarun) (unknown source) 18:55:43 (Unknown Source) [Maltitreded HTTP Connection Manager Cleanup] DEBUG org.apache.commons.httpclient.MultiThreadedHttpConnectionManager - referenceCouplethread at java.lang.InterruptedException at java.lang.Object.wait (the original method) at java.lang.ref.ReferenceQueue.remove (reference queue.java: 135) ava.lang.ref.ReferenceQueue.remove in Jammu org.apache.commons.httpclient.MultiThreadedHttpConnectionManager $ ReferenceQueueThread.run (ReferenceQueue.java151) (MultiThreadedHttpConnectionManager.java:1122)  
< P> Required output:

  18:55:42 [pool-1-thread -2] information jfileupload.download.http.a - Download Full 18:55:42 [HTTPDOWNLOAD] error jfileupload.download.ui .DownloadTransferUI -java.io.IOException: File: URI to show / home / Rahul / desktop /, sun.awt.x11.xDesktopPeer.launch (XDesktopPeer.java:114), but at sun.awt.X11.XDesktopPeer .open (XDesktopPeer.java:77), at java.awt.Desktop.open, (Desktop.java:272), in jfileupload.download.ui.DownloadTransferUI.a (unknown source), jfileupload.download.http.HTTPDownloadTransfer Ka (unknown source) at jfileupload.download.aarun (unknown source) at java.lang.Thread.run (Thread.java:745) 18:55:43 [MultiThreadedHttpConnectionManager cleaning] DEBUG org.apache.commons.httpclient .MultiThreadedHttpConnec In tionManager - interrupted ReferenceQueueThread, java.lang.InterruptedException, java.lang.Object.wait (Native Method) at java.lang.ref.ReferenceQueue.remove, (ReferenceQueue.java:135), on java.lang.ref . ReferenceQueue.remove (ReferenceQueue.java151), org.apache.commons.httpclient.MultiThreadedHttpConnectionManager $ ReferenceQueueThread.run (MultiThreadedHttpConnectionManager.java:1122)  

In the above input I want < Line>

Do not try it but it should work

  awk '/ [0- 9] +: [0- 9] +: [ 0-9] + / {x = $ 0} {a [x] = a [x]? (I) print [i]} 'file  

for a [x] "," $ 0: $ 0} end {.

  / [0-9] +: [0- 9] +: [0-9] + / If this pattern is matched {x = $ 0}, then the line x { A [x] = a [x]? Set to the value of a [x] "," $ 0: $ 0}, set the associate with the array, with the array ($ 0) to use the turner operator to start with the check [x] is a value  a [i]} adds [x] END {current} line to print [i]} when all records are processed through the array and output values ​​ 

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -