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 )

  • vpklotar@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    1 day ago

    I know this isn’t grep or awk but of you simply want the first part I would probably use cut as following: ``` cut -d : -f 1

    
    Simply put, cut the line in multiple parts with the colon as the delimiter and choose the first part.