1

I am trying to get from this:

1200        PORTAL  oracle  29489   17:57   48 username cell single block physical read 2

to this:

EXEC SYS.KILLSID (1200,29489,2)

 

1
  • also 1st number (1200) can be any number from 1 to 4 digits long. some thing with second number (29489) could be 4 to 5 digits long and last number (2) is always 1 digit long.
    – redninam
    Nov 21, 2017 at 23:56

2 Answers 2

1
find ^(\d{1,4}) [^\d]\*(\d{4,5}) .*(\d)$
replace EXEC SYS.KILLSID (\1,\2,\3)
1
  • Ctrl+H
  • Find what: ^(\d{1,4})\D+(\d{4,5}).+(\d)$
  • Replace with: EXEC SYS.KILLSID \($1,$2,$3\)
  • check Wrap around
  • check Regular expression
  • DO NOT CHECK . matches newline
  • Replace all

Explanation:

^           : begining of line
  (\d{1,4}) : group 1, 1 to 4 digits
  \D+       : 1 or more non digits
  (\d{4,5}) : group 2, 4 or 5 digits
  .+        : 1 or more any character but newline
  (\d)      : group 3, 1 digit
$           : end of line

Replacement:

EXEC SYS.KILLSID    : literally
\(                  : open parenthesis, in Npp, it has to be escaped
  $1                : content of group 1
  ,                 : a comma
  $2                : content of group 2
  ,                 : a comma
  $3                : content of group 3
\(                  : close parenthesis, in Npp, it has to be escaped

Result for given example:

EXEC SYS.KILLSID (1200,29489,2)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .