Artificial intelligent assistant

Split the line into next line after a matching pattern In the input file shown below, I am trying to find the string `job_type` and move the it to the next line if it matches job_type. I tried this, but it is not working: sed "s/[A-Z][a-z]*job_type:/\njob_type:/g" Input: insert_job: VAU_vaultnotification_ertgvfg_job job_type: xxx insert_job: VAU_vaultnotification_ertgvfg_frd job_type: yyy insert_job: VAU_vaultnotification_ertgvfg_erb job_type: SXC job_type: CMD insert_job: VAU_vaultnotification_ertgvfg_frd job_type: YUI Expected output: insert_job: VAU_vaultnotification_ertgvfg_job job_type: xxx insert_job: VAU_vaultnotification_ertgvfg_frd job_type: yyy insert_job: VAU_vaultnotification_ertgvfg_erb job_type: SXC job_type: CMD insert_job: VAU_vaultnotification_ertgvfg_frd job_type: YUI

Your requirements are not clear to me, but maybe you want:


sed 's/\([[:upper:]][[:alpha:]_]*\)[[:space:]]\{1,\}\(job_type:\)/\1\
\2/g'


Or:


perl -Mopen=locale -pe 's/\b\p{Lu}\w*\K\s+(job_type:)/\
$1/g'

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 69d5f12296f8619adef04f1f37654ce8