linux - How to add text at the end of each line after skipping Last N characters -


i'm on linux command line , have log file following content

subscription service shutdown @ 9:59pm utc subscription service restarted @ 11:57pm utc 

i want add date before time stamp every line

subscription service shutdown @ 01 oct 2016 9:59pm utc subscription service restarted @ 01 oct 2016 11:57pm utc 

something this:

sed -r "s/([0-9]+{1}:[0-9]+{1}[a-z]{2}.*$)/01 oct 2016 \1/g" test.txt > new.txt

where text.txt log file , "01 oct 2016 " text , \1 time inserted in group match.


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - IE9 error '$'is not defined -