Jump to content

britesc

New Members
  • Posts

    6
  • Joined

  • Last visited

britesc's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you very much. Kind regards, jB
  2. Erm, The output is great thanks but I am having a problem iterating through the output file. For instances I was grabbing $names[12] as the line to work on, only to discover that the output varies according to the capabilities of the drive, so the line is not always $names[12]. The line from SMART that I need always starts with the value 194, so I need to be able to grab that line to work on. It could be $names[6] or $names[n]. Really appreciate the steer. Over 6 years since I coded php so tad slow at the moment, sorry. regards, jB
  3. Once again, thank you. Just ordered an O'Reilly Book on Regex from Amazon so within the next couple of weeks I should become an expert (Yes really, the book says so). regards, jB
  4. Hi, Tried to click the thanks button but it says I can't...
  5. Hi Ch0cu3r, Thanks for the very quick reply. Just to ensure my slow old brain has grasped this. This regex would extract the temperature ie. -23 or 0 or 42 or 123 ? Sorry to be pedantic regex is an arcane art at the moment. Kind regards, jB
  6. Hi, I was wondering if some kind person could help me with this. I need to make a call to file under linux that returns various SMART HDD data. From that file I want to see that each line ends in OK. I also want to extract the HDD Temperature from a line with a specific identifier on it. Filename = get_hd_smartinfo -d1 Response = 001 Raw_Read_Error_Rate 0 100 100 016 OK 002 Throughput_Performance 0 100 100 054 OK 003 Spin_Up_Time 321 (Average 164) 237 237 024 OK 004 Start_Stop_Count 6286 099 099 000 OK 005 Reallocated_Sector_Ct 0 100 100 005 OK 007 Seek_Error_Rate 0 100 100 067 OK 008 Seek_Time_Performance 0 100 100 020 OK 009 Power_On_Hours 30115 096 096 000 OK 010 Spin_Retry_Count 0 100 100 060 OK 012 Power_Cycle_Count 81 100 100 000 OK 192 Power-Off_Retract_Count 7535 094 094 000 OK 193 Load_Cycle_Count 7535 094 094 000 OK 194 Temperature_Celsius 42 142 142 000 OK 196 Reallocated_Event_Count 0 100 100 000 OK 197 Current_Pending_Sector 0 100 100 000 OK 198 Offline_Uncorrectable 0 100 100 000 OK 199 UDMA_CRC_Error_Count 0 200 200 000 OK Line = 194 Temperature_Celsius Value I want to capture = 42 in this case. I am sure there is an easier way than my tired old brain suggests, which is to output to a file, read file, grab line then somehow grab value, in a huge block of code. Thanks to anyone who can help me out. Kind regards, jB
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.