jeudi 26 février 2015

problem with sed inside sed


i am trying to parse a string inside a sed command but i am getting errors. if some1 can help me... it would be nice. i dunno what else to try



sed -e "/pd begin $(echo 3:1I:1:1|sed 0,/:/{s/:/' '/})",/pd end $(echo 3:1I:1:1|sed 0,/:/{s/:/' '/})/p /tmp/hp-raid-data-harvester.out


i need to replace the first ':' from the string "3:1I:1:1". it has to be in one line and cant be changed before. The string is comming form the database with string $1


file hp-raid-data has inside those lines



### pd begin 3 2I:1:1 ###

Smart Array P410 in Slot 0

array B

physicaldrive 2I:1:1
Port: 2I
Box: 1
Bay: 4
Status: OK
Drive Type: Data Drive
Interface Type: SATA
Size: 3 TB
Rotational Speed: 7200
Firmware Revision: CC4H
Serial Number: Z1F21GLG
Model: ATA ST3000DM001-9YN1
SATA NCQ Capable: True
SATA NCQ Enabled: True
Current Temperature (C): 33
Maximum Temperature (C): 42
PHY Count: 1
PHY Transfer Rate: 3.0Gbps


### pd end 3 2I:1:1 ###


sorry for bad english but i am writting in a hurry



Aucun commentaire:

Enregistrer un commentaire