How to grep out substring which can change?

后端 未结 6 1475
孤独总比滥情好
孤独总比滥情好 2021-01-27 18:42

Basically I have a very large text file and each line contains

tag=yyyyy;id=xxxxx;db_ref=zzzzz; 

What I want is to grep out the id, but the id

6条回答
  •  忘了有多久
    2021-01-27 19:47

    perl -lne 'print $1 if(/id=([^\;]*);/)' your_file
    

    tested:

    > echo "tag=yyyyy;id=xxxxx;db_ref=zzzzz; "|perl -lne 'print $1 if(/id=([^\;]*);/)'
    xxxxx
    >
    

提交回复
热议问题