Sed Remove 3 last digits from string -


27211;18:05:03479;20161025;0;0;0;0;10991;0;10991;000;0;0;000;1000000;0;0;000;0;0;0;82 

second string after ; time. gg:mm:sssss:. want gg:mm:ss:

like so:

27211;18:05:03;20161025;0;0;0;0;10991;0;10991;000;0;0;000;1000000;0;0;000;0;0;0;82 

i tried cut deletes after n'th occurance of character, , stuck, please help.

give 1 liner try:

awk -f';' -v ofs=";" 'sub(/...$/,"",$2)+1' file 

it removes last 3 chars column 2.

update sed 1 liner

if fan of sed:

sed -r 's/(;[^;]*)...;/\1;/' file 

Comments

Popular posts from this blog

sql - can we replace full join with union of left and right join? why not? -

javascript - Parallax scrolling and fixed footer code causing width issues -

iOS: Performance of reloading UIImage(name:...) -