regex - Use 'sed' to find a number in line -
i trying use unix sed command find line numbers match particular regular expression. pattern of file below
murali : 20 # krishna: 21 $ hari: 22 @ murali : 23 #
i need output numbers below using sed
command
20 21 22 23
can please me regular expression sed
.
how
$ cat input murali : 20 # krishna: 21 $ hari: 22 @ murali : 23 # $ sed -r 's/^[^0-9]+([0-9]+).*/\1/g' input 20 21 22 23
[^0-9]+
matches other digit([0-9]+)
matches digits, captured in group 1.*
matches rest
Comments
Post a Comment