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

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

Laravel mail error `Swift_TransportException in StreamBuffer.php line 269: Connection could not be established with host smtp.gmail.com [ #0]` -

c# SetCompatibleTextRenderingDefault must be called before the first -