bash: retrieving number after a given string -


i have file following:

  blabla sometinh#lulwut-12342"asa   haha"lulwut-9635bgh   haha'lulwut-3679//stuff 

the pattern lulwut- precedes 4 of 5 number sequence. how can retrive number pattern?

for example abode be

blabla sometinh#lulwut-12342"asa > lulwut-12342 haha"lulwut-9635bgh              > lulwut-9635 haha'lulwut-3679//stuff          > lulwut-3679 

to match lulwut- followed 4 or file digit pattern, can use this:

grep -o 'lulwut-[0-9]\{4\}[0-9]\?' file 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -