Skip to main content
added 8 characters in body; edited tags; edited title
Source Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 265

Regex to formateformat files output

I have file withwhich has the following contents:

   foo-6-25.example.com:
         1  Var. Speed   System Board    Normal     Yes     Normal   ( 49)
    --
    foo-5-4.example.com:
         1  Var. Speed   System Board    Normal     Yes     Normal   ( 19)
    --
    foo-8-28.example.com:
         1  Var. Speed   System Board    Normal     Yes     Normal   ( 43)
    --
    foo-9-7.example.com:
         1  Var. Speed   System Board    Normal     Yes     Normal   ( 91)
    --
    foo-5-19.idmz.example.com:
         1  Var. Speed   System Board    Normal     Yes     Normal   ( 19)
    --
    foo-7-3.example.com:
         1  Var. Speed   System Board    Normal     Yes     Normal   ( 20)

I want to formateformat it in the following way,: servername and then its FAN speed which is inside () bracket

foo-6-25.example.com: ( 49)
foo-5-4.example.com:  ( 19)

Not sure how to use that using awk or any other tools.

Regex to formate files output

I have file with has following contents:

   foo-6-25.example.com:
         1  Var. Speed   System Board    Normal     Yes     Normal   ( 49)
    --
    foo-5-4.example.com:
         1  Var. Speed   System Board    Normal     Yes     Normal   ( 19)
    --
    foo-8-28.example.com:
         1  Var. Speed   System Board    Normal     Yes     Normal   ( 43)
    --
    foo-9-7.example.com:
         1  Var. Speed   System Board    Normal     Yes     Normal   ( 91)
    --
    foo-5-19.idmz.example.com:
         1  Var. Speed   System Board    Normal     Yes     Normal   ( 19)
    --
    foo-7-3.example.com:
         1  Var. Speed   System Board    Normal     Yes     Normal   ( 20)

I want to formate it in following way, servername and then its FAN speed which is inside () bracket

foo-6-25.example.com: ( 49)
foo-5-4.example.com:  ( 19)

Not sure how to use that using awk or any other tools

Regex to format files output

I have file which has the following contents:

   foo-6-25.example.com:
         1  Var. Speed   System Board    Normal     Yes     Normal   ( 49)
    --
    foo-5-4.example.com:
         1  Var. Speed   System Board    Normal     Yes     Normal   ( 19)
    --
    foo-8-28.example.com:
         1  Var. Speed   System Board    Normal     Yes     Normal   ( 43)
    --
    foo-9-7.example.com:
         1  Var. Speed   System Board    Normal     Yes     Normal   ( 91)
    --
    foo-5-19.idmz.example.com:
         1  Var. Speed   System Board    Normal     Yes     Normal   ( 19)
    --
    foo-7-3.example.com:
         1  Var. Speed   System Board    Normal     Yes     Normal   ( 20)

I want to format it in the following way: servername and then its FAN speed which is inside () bracket

foo-6-25.example.com: ( 49)
foo-5-4.example.com:  ( 19)

Not sure how to use that using awk or any other tools.

Source Link
Satish
  • 1.7k
  • 4
  • 36
  • 63

Regex to formate files output

I have file with has following contents:

   foo-6-25.example.com:
         1  Var. Speed   System Board    Normal     Yes     Normal   ( 49)
    --
    foo-5-4.example.com:
         1  Var. Speed   System Board    Normal     Yes     Normal   ( 19)
    --
    foo-8-28.example.com:
         1  Var. Speed   System Board    Normal     Yes     Normal   ( 43)
    --
    foo-9-7.example.com:
         1  Var. Speed   System Board    Normal     Yes     Normal   ( 91)
    --
    foo-5-19.idmz.example.com:
         1  Var. Speed   System Board    Normal     Yes     Normal   ( 19)
    --
    foo-7-3.example.com:
         1  Var. Speed   System Board    Normal     Yes     Normal   ( 20)

I want to formate it in following way, servername and then its FAN speed which is inside () bracket

foo-6-25.example.com: ( 49)
foo-5-4.example.com:  ( 19)

Not sure how to use that using awk or any other tools