|The diversification and rapid spread of communication services have made networks operated by telecom companies extremely large and complex, and network management, including fault diagnosis, has become increasingly complicated. Conventional failure diagnosis in which network operators execute network commands on network elements to find the root causes of failures does not scale, and its automation is highly demanded. However, the outputs of network commands for troubleshooting, called device command outputs, are unstructured text messages consisting of tens to thousands of lines, and therefore their automatic analysis and information extraction have been challenging. This study proposes a feature extraction method from device command outputs toward automation of fault diagnosis. The proposed method consists of four parts: First, the device command outputs are divided into blocks, which are smaller units. Next, similar blocks are grouped by hierarchical clustering, and then commonly appeared word sequences are extracted as templates. Finally, by using the obtained templates, we identify the parameter parts of the device command outputs and construct feature vectors taking into account word types. We apply the proposed method to data captured at a real network and evaluate its accuracy. Moreover, as an application of the extracted feature vectors, we perform anomaly detection using device command outputs based on supervised machine learning and demonstrate the usefulness of the proposed method.