I have a script which uses sed in a loop to delete lines containing words from a list:
for i in $list; do sed -i "/$i/d" file done
$list is created from an SQL query:
list=$(psql -d dbname -t -c "SELECT foo from table ORDER BY column DESC")
The problem is my company recently implemented tighter auditd rules which include all
fchmod syscalls. Using
strace, I see every
sed -i includes one
With a large list variable,
iowait skyrockets and the system actually bogs down because auditd is writing a ridiculous amount of lines to its log.
I'm trying to figure out if there's a way to pass the list variable to sed in one line so the file is only opened and closed once.
I've already asked, any changes to the auditd rules is a non-starter.