I have a sample input below and I would like to extract each individual column using regex but it cant work for multiple consecutive blank spaces. I've tried "([0-9])\s+([0-9])\s+([A-Za-z0-9- ]+)\s{2,}([A-Za-z0-9- ]+)\s+([A-Za-z0-9]+)
" and it should work for each row.
Output Module Ports Type Model Serial No. --------- ----- ------------------------------------ --------------- ----------- 1 2 CCS-7354 Series Supervisor Module 7354-SPP JD546546527 2 1 Standby supervisor Unknown Unknown 3 28 28-port SFP+ 10GigE Linecard 7234S-PC FGK10449938
For the first row of the input result, I should get:
- "1" for "Output Module".
- "2" for "Ports"
- "CCS-7354 Series Supervisor Module" for "Type".
- "7354-SPP" for Model.
- "JD546546527" for "Serial No."
I'm getting "CCS-7354 Series Supervisor Module 7354-SPP
" for the Type which is incorrect.
没有评论:
发表评论