简体   繁体   中英

How to remove this lines in the middle?

I have dump JVM thread from a server. From the dump, I'd like to erase some line using regex.

    at java.lang.Thread.run(Thread.java:722)

   Locked ownable synchronizers:
    - <0x00000005b8052b20> (a java.util.concurrent.ThreadPoolExecutor$Worker)

"catalina-exec-126" daemon prio=10 tid=0x00007f7b58ac5800 nid=0x4171 runnable [0x00007f7ac4800000]

I want the output to be like this

    at java.lang.Thread.run(Thread.java:722)

"catalina-exec-126" daemon prio=10 tid=0x00007f7b58ac5800 nid=0x4171 runnable [0x00007f7ac4800000]

Does anyone have an idea how to do this using regex? Because the value is dynamic. Please suggest

It seems that you made a thread dump.

You can try this awk one-liner to modify your dump file:

awk -v RS="\n\n" -v ORS="\n\n" '!/Locked ownable synchro/' yourDump > newDump

btw, this is not a java question, although your input file was created by jstack.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM