fork(4) download
  1. import re
  2.  
  3. output = "sgncs1#sh ver Cisco IOS Software, C3550 Software (C3550-IPSERVICESK9-M), Version 12.2(44)SE6, RELEASE SOFTWARE (fc1) Copyright (c) 1986-2009 by Cisco Systems, Inc. Image text-base: 0x00003000, data-base: 0x012A99FC ROM: Bootstrap program is C3550 boot loader sgncs1 uptime is 5 weeks, 2 days, 20 hours, 12 minutes System image file is \"flash:c3550-ipservicesk9-mz.122-44.SE6.bin\" Cisco WS-C3550-24 (PowerPC) processor (revision G0) with 65526K/8192K Processor board ID CHK0644W0KC Model number: WS-C3550-24-SMI System serial number: CHK0644W0KC"
  4. regex_serial2 = re.compile(r'System serial number:\s(\S+)')
  5. serial2 = regex_serial2.findall(output)
  6. print(serial2)
Success #stdin #stdout 0.02s 27712KB
stdin
Standard input is empty
stdout
['CHK0644W0KC']