Search for a specific RegEx

0

I have a command who make an output like that :

[size][tabulation][path]

I want to exclude all path that have more than one level

keep :

/a

exclude :

/a/b

or :

/a/b/c[...]

But i didn't found any RegEx who can do that. I think about something like

[space][path][space]

but there not any space in the output, just one tabulation per line and that's all

Do you have any idea ?

wxi

Posted 2019-02-04T21:33:57.500

Reputation: 43

Answers

0

Use:

egrep '\s/[^/]+$' 

**Explanation

\s          # any kind of spaces
/           # a slash
[^/]+       # character class, 1 or more any character that is not a slash
$           # end of line

Toto

Posted 2019-02-04T21:33:57.500

Reputation: 7 722