-1

I just want to remove line break after "ParNew" string.

i.e. next line of ParNew should be merged in ParNew line.

2019-01-11T09:24:17.063+0800: 519253.299: [GC 519253.300: [ParNew
: 846970K->7882K(943744K), 0.0466880 secs] 74546294K->73707206K(75392640K), 0.0479230 secs] [Times: user=0.77 sys=0.00, real=0.05 secs] 
- age   3:        360 bytes,    6983240 total
- age   2:       1680 bytes,    6982880 total
- age   1:    6981200 bytes,    6981200 total
Desired survivor size 53673984 bytes, new threshold 4 (max 4)
2019-01-11T09:24:16.645+0800: 519252.881: [GC 519252.882: [ParNew
: 846986K->8058K(943744K), 0.0470990 secs] 74547818K->73708889K(75392640K), 0.0483330 secs] [Times: user=0.78 sys=0.00, real=0.05 secs] 
- age   4:        512 bytes,    7107392 total
- age   2:       1968 bytes,    7106880 total
- age   1:    7104912 bytes,    7104912 total
Ankit Goyal
  • 151
  • 1
  • 12
  • It would help to know what programming language or text editor you are using. Not all regex is created equal. – Kenneth K. Feb 04 '19 at 21:48
  • Actually I have tried both sed in linux and notepad++ on windows. but couldn't figure it out exact solution. – Ankit Goyal Feb 04 '19 at 21:55
  • Possible duplicate of [Regex to check for new line](https://stackoverflow.com/questions/12111776/regex-to-check-for-new-line) – Scott Weaver Feb 04 '19 at 22:08

1 Answers1

1

Perl allows multi-line regexes. Try this line:

perl -ne 's/ParNew\n/ParNew/g; print;' your_file.txt

Result:

2019-01-11T09:24:17.063+0800: 519253.299: [GC 519253.300: [ParNew: 846970K->7882K(943744K), 0.0466880 secs] 74546294K->73707206K(75392640K), 0.0479230 secs] [Times: user=0.77 sys=0.00, real=0.05 secs] 
- age   3:        360 bytes,    6983240 total
- age   2:       1680 bytes,    6982880 total
- age   1:    6981200 bytes,    6981200 total
Desired survivor size 53673984 bytes, new threshold 4 (max 4)
2019-01-11T09:24:16.645+0800: 519252.881: [GC 519252.882: [ParNew: 846986K->8058K(943744K), 0.0470990 secs] 74547818K->73708889K(75392640K), 0.0483330 secs] [Times: user=0.78 sys=0.00, real=0.05 secs] 
- age   4:        512 bytes,    7107392 total
- age   2:       1968 bytes,    7106880 total
- age   1:    7104912 bytes,    7104912 total

Here:

  • -e allows to execute the command (pattern substitution)
  • -n embeds the command in an implicit loop which will iterate over each lines got from stdin
Amessihel
  • 5,891
  • 3
  • 16
  • 40