#!/usr/bin/perl -w use strict; while(){ if(/\s+encryption key (\d+) size (\d+)bit \d+ (\S+)/){ print qq|$1\t$2\t$3\n|; } } 1; __DATA__ show run Building configuration... ! encryption key 1 size 40bit 7 621AA6093A25 transmit-key encryption key 2 size 40bit 7 7260637E4720 encryption key 3 size 40bit 7 0F733F116035 encryption key 4 size 40bit 7 03B71F3D601D encryption mode wep mandatory !