请参考下面的文件内容。
@HD VN:1.0 SO:unsorted
@SQ SN:Chr1 LN:30427680
@PG ID:bowtie2 PN:bowtie2 VN:2.1.0如何使用awk或任何其他unix命令仅提取数字30427680。
发布于 2013-10-14 18:24:21
使用grep:
grep -oP 'LN:\K.*' filename发布于 2013-10-14 18:27:11
只需使用grep:
grep -o 30427680 file
-o, --only-matching
Prints only the matching part of the lines.发布于 2013-10-14 19:27:25
使用珀尔:
perl -ne 'print $& if /LN:\K.*/' filename或
perl -ne 'print $1 if /LN:(.*)/' filenamehttps://stackoverflow.com/questions/19366537
复制相似问题