We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
'Sed' command #5
'Sed' command #5
Sort by
recency
|
89 Discussions
|
Please Login in order to post a comment
pretty hardcoded but still works
Test case 3 does NOT confirm to the problem specification:
This works
-E saves me :)
sed -E 's/([0-9]{4} )([0-9]{4} )([0-9]{4} )([0-9]{4})/\4 \3\2\1/g'
The back-reference. \1, \2, \3, \4, etc. refer to the first, second, third, etc. parenthesized group in the regular expression.
OR
{n} means "exactly n of the preceding expression" in a regular expression.