Skip to main content
deleted 1 character in body
Source Link
Stéphane Chazelas
  • 585.1k
  • 96
  • 1.1k
  • 1.7k

\w match "word" symbols (letters, digits and underscore) but in your example there is / after com which is not :alnum: so your pattern match nothing == empty output.

You can add / to pattern and look what is happend:

grep -oP 'com\'com/\K\w+'

FYR -P option is experimental and can do which not expected in more systems, so you can do your task in other way:

sed "/com/s/.*\/\(\w\+\).\?$/\1/" 

\w match "word" symbols (letters, digits and underscore) but in your example there is / after com which is not :alnum: so your pattern match nothing == empty output.

You can add / to pattern and look what is happend:

grep -oP 'com\/\K\w+'

FYR -P option is experimental and can do which not expected in more systems, so you can do your task in other way:

sed "/com/s/.*\/\(\w\+\).\?$/\1/" 

\w match "word" symbols (letters, digits and underscore) but in your example there is / after com which is not :alnum: so your pattern match nothing == empty output.

You can add / to pattern and look what is happend:

grep -oP 'com/\K\w+'

FYR -P option is experimental and can do which not expected in more systems, so you can do your task in other way:

sed "/com/s/.*\/\(\w\+\).\?$/\1/" 
deleted 6 characters in body
Source Link
Costas
  • 15k
  • 24
  • 38

\w match "word" symbols (letters, digits and underscore) but in your example there is / after com which is not :alnum: so your pattern match nothing == empty output.

You can add / to pattern and look what is happend:

grep -oP 'com\/\K\w+'

FYR -P option is experimental and can do which not expected in more systems, so you can do your task in other way:

sed "/com/s/.*\/\(\w\+\).\?$/\1/" 

\w match "word" symbols (letters, digits and underscore) but in your example there is / after com which is not :alnum: so your pattern match nothing == empty output.

You can add / to pattern and look what is happend:

grep -oP 'com\/\K\w+'

\w match "word" symbols (letters, digits and underscore) but in your example there is / after com which is not :alnum: so your pattern match nothing == empty output.

You can add / to pattern and look what is happend:

grep -oP 'com\/\K\w+'

FYR -P option is experimental and can do which not expected in more systems, so you can do your task in other way:

sed "/com/s/.*\/\(\w\+\).\?$/\1/" 
deleted 6 characters in body
Source Link
Costas
  • 15k
  • 24
  • 38

\w match alphanumeric"word" symbols (letters, digits and underscore) but in your example after com there is / after com which is not :alnum: so your pattern match nothing == empty output.

You can add / to pattern and look what is happend:

grep -oP 'com\/\K\w+'

\w match alphanumeric symbols (letters, digits and underscore) but in your example after com there is / which is not :alnum: so your pattern match nothing == empty output.

You can add / to pattern and look what is happend:

grep -oP 'com\/\K\w+'

\w match "word" symbols (letters, digits and underscore) but in your example there is / after com which is not :alnum: so your pattern match nothing == empty output.

You can add / to pattern and look what is happend:

grep -oP 'com\/\K\w+'
Source Link
Costas
  • 15k
  • 24
  • 38
Loading