It generates the results I want, except in the case that the grep result is empty.
When there is no digit present, the command prints nothing and the result will end up with 1 line less. That gives a problem in further processing. I need the same number of lines as in the original file. So in that case I'd like to insert a new line for further processing.
And the code needs to be in one line
Note : grep's default mode is (iirc) POSIX regex, and \d is pcre. You can either pass -P to gnu grep, for perl-like regexps, or use [[:digit:]] instead of \d ( BSD grep's -E mode includes \d )
@MadeInGermany
I need this result with blank lines because the result should match with the original cvs. Otherwise data from different lines get mixed up.
The resulting data wil be used for a new column added to the original
What is expected output for the given sample ?
In case if you expect newline to be printed for the line which does not content digits, you may try below command