Check for missing line in files recursively and add it
$10-30 USD
Terminado
Publicado hace alrededor de 9 años
$10-30 USD
Pagado a la entrega
Hi,
I need a shell, python, or perl script i can run in cron at 1 min interval temporarily on CentOS6 that does the following.
It searches /home/xen recursively looking for the following line in all .cfg files it finds in all subdirectories.
This line exactly:
device_model_version = 'qemu-xen-traditional'
Only if it's missing it adds it to the end of the file
Example directory structure showing multiple files it would need to iterate through in different subdirectories of /home/xen
[root@xenhost1 xen]# pwd
/home/xen
[root@xenhost1 xen]# ls -Rl
.:
total 8
drwxr-xr-x 3 root root 4096 Feb 19 16:15 vm101
drwxr-xr-x 3 root root 4096 Feb 18 15:58 vm102
./vm101:
total 8
drwxr-xr-x 2 root root 4096 Dec 15 14:50 mnt
-rw-r--r-- 1 root root 755 Feb 18 15:58 [login to view URL]
./vm101/mnt:
total 0
./vm102:
total 8
drwxr-xr-x 2 root solusvm 4096 Feb 12 16:55 mnt
-rw-r--r-- 1 solusvm solusvm 755 Feb 18 15:58 [login to view URL]
./vm102/mnt:
total 0
[root@xenhost1 xen]#