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
|
86 Discussions
|
Please Login in order to post a comment
-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.
The back-reference sounds good
sed -r 's/(\d{4}) (\d{4}) (\d{4}) (\d{4})/\4 \3 \2 \1/g'
case 'E': case 'r': if (extended_regexp_flags) usage(4); extended_regexp_flags = REG_EXTENDED; break;
using regex sed -E 's/([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+)/\4 \3 \2 \1/' It should work for you