Tente isto:
sed '2,$s/^Virtual Machine/\n&/' file
Como posso adicionar espaços entre minhas saídas usando o sed / echo ou qualquer outro comando no linux?
Saída preferida:
Virtual Machine Test01 status Running.
Virtual Disk Test01 size 61GB
Physical Disk HITACHI (170)
Physical Disk HITACHI (171)
Physical Disk HITACHI (172)
Virtual Machine Test02 status Running.
Virtual Disk Test02 size 61GB
Physical Disk HITACHI (163)
Physical Disk HITACHI (164)
Physical Disk HITACHI (165)
Physical Disk HITACHI (173)
Virtual Machine Test03 status Running.
Virtual Disk Test03_DISK1 (33) size 61GB
Physical Disk HITACHI (137)
Physical Disk HITACHI (138)
Meu script o / p:
cat /tmp/test.txt | while read in; do echo -en '\n'; ./ovm_vmdisks -u admin -p xxxxxx -h localhost -v "$in"; done | sed "s/'//g" | egrep -i "Virtual Machine|Virtual Disk|Physical Disk" |sed "s/://g" > /tmp/Automated/Virtualmachines_DETAILS.txt; cat /tmp/Automated/Virtualmachines_DETAILS.txt
Virtual Machine Test01 status Running.
Virtual Disk Test01 size 61GB
Physical Disk HITACHI (170)
Physical Disk HITACHI (171)
Physical Disk HITACHI (172) <<<< My First output ends here and right after this i would need spaces
Virtual Machine Test02 status Running.
Virtual Disk Test02 size 61GB
Physical Disk HITACHI (163)
Physical Disk HITACHI (164)
Physical Disk HITACHI (165)
Physical Disk HITACHI (173) <<<< Second one and so on
Virtual Machine Test03 status Running.
Virtual Disk Test03_DISK1 (33) size 61GB
Physical Disk HITACHI (137)
Physical Disk HITACHI (138)
Escreva e esvazie o eco onde você deseja que a nova linha
Por exemplo
echo Foo
echo
echo Bar
Resultados em ...
Foo
Bar
Tags python perl sed linux shell-script