我想重用这里给出的代码,但我一直在理解使用sed:
print "Sending to QRadar...\n";
# SSH To QRadar's Console and push out file + trigger update
`scp -i $qradar_ssh_key -o UserKnownHostsFile=$qradar_ssh_knownhosts -o StrictHostKeyChecking=no root\@$qradar_console:/store/configservices/staging/globalconfig/remotenet.conf .`;
`sed -i -e '/^SECULERT/d' remotenet.conf`;
`cat $seculert_qradar_list >> remotenet.conf`;
`scp -i $qradar_ssh_key -o UserKnownHostsFile=$qradar_ssh_knownhosts -o StrictHostKeyChecking=no remotenet.conf root\@$qradar_console:/store/configservices/staging/globalconfig/remotenet.conf`;
Run Code Online (Sandbox Code Playgroud)
我想知道sed这里在做什么。
小智 7
在给定的行中,
`sed -i -e '/^SECULERT/d' remotenet.conf`;
Run Code Online (Sandbox Code Playgroud)
该-i标志表示sed正在remotenet.conf就地编辑并-e '/^SECULERT/d'删除所有以“SECULERT”开头的行。