Как найти строку сразу после заданной строки

Добавлено в.xinitrc после обнаружения кода клавиши ö с помощью$ xev

    # Remap ö to Return
    xmodmap -e "keycode 47 = Return"
1
23.06.2020, 16:35
1 ответ

Попробуйте это, я думаю, это сработает для вас:

$ awk -v d="Jun 04 09" 'BEGIN { n=1;i=1;start=0;split(d,mon);extrahour=mon[1]" "mon[2]" "mon[3]+1;}

/mystring/ { if (i==1 && start == 1 ){ n=split(a,b,"\n");for (j=1;j<n;j++) print b[j];a="";  }

if (start == 1) { print "-----\n"l"\n"$0;n=2;i=1;next} }

/^Incremental/ { if (start==1) { print a"\n"$0;a="";n=1;i=0; }}

{ if( $0 ~ d )start=1; if ( $0 ~ mon[1] &&  ( $0 !~ d && $0 !~ extrahour ) ) {start=0;} 

  if ( start==1 ) {  l=$0; if (n==2) a=a"\n"$0  }

 } ' file | sed /^$/d

-----
Thu Jun 04 09:22:50 2020
mystring3: APP failed to died. Likely the connection
has been lost. PKCS11 function C_EncryptInit returned
PKCS11 error code: 6
APP connection lost, closing wallet
Thu Jun 04 09:32:20 2020
Incremental point up to RBA [0x5a5f.43feb8.0], current log tail at RBA [0x5a5f.44d433.0]
-----
Thu Jun 04 09:39:54 2020
mystring3: APP failed died. Likely the connection
has been lost. PKCS11 function C_EncryptInit returned
PKCS11 error code: 6
APP connection lost, closing wallet
-----
Thu Jun 04 09:51:12 2020
mystring1: APP failed check failed to cache
object handle. Error code: 1014
APP connection lost, closing wallet
Thu Jun 04 09:51:18 2020
Errors in file /folder1/folder2/folder3/file.log:
Err-9087: cpu time or run time policy violation
Thu Jun 04 09:52:07 2020
Dumping diagnostic data in directory=[cdmp_20200604095207], requested by (instance=8, osid=313861), summary=[incident=969964].
Thu Jun 04 10:02:24 2020
Incremental point up to RBA [0x5a5f.48846c.0], current log tail at RBA [0x5a5f.4a1de0.0]
2
18.03.2021, 23:25

Теги

Похожие вопросы