Hi,

I would like to found a regex match in a stdout

stdout

 /dev/loop0: [2081]:64 (/a/path/to/afile.dat)

I would like to match

/dev\/loop\d/

and return /dev/loop0

but the \d seem not working with awk … ?

How to achieve this ? ( awk is not mandatory )

  • unlawfulbooger@lemmy.blahaj.zone
    link
    fedilink
    arrow-up
    4
    ·
    edit-2
    1 day ago

    You could try [0-9] instead?

    awk '/\/dev\/loop[0-9]/ {print}'
    

    If you have a larger sample of input and desired output, people can help you better.