mardi 4 août 2015

Split UNIX String with DOT delimiter and store in variable

I have a file abc.123.234.345 and I want to store value of 123.234.345 into variable1 using UNIX oneliner. Then I have to rename a file named def as def.123.234.345 I tried sed, awk but not able to generate split string.

I have to search as abc.*.*.* as string will be different every time.

Any suggestions?

Some sample that I use but not working

FILE=abc.*.*.* | mv /loc/def /loc/def.${FILE#*.}

Aucun commentaire:

Enregistrer un commentaire