tente sed
sed -r -e 's/\^//g;s/^.{13}/&(/;s/^.{17}/&)-/' file
NE234GJKLKU,*(978)-9098
NE345HJsdfe,*(153)-4656
YBKJNJKHBKK,*(198)-7654
UTGHNKOIUYO,*(112)-3421
ERTYUIJHGLK,*(145)-6666
Eu tenho strings como estas
NE234GJKLKU,*9^789098
NE345HJsdfe,*1^534656
YBKJNJKHBKK,*1^987654
UTGHNKOIUYO,*1^123421
ERTYUIJHGLK,*1^456666
que eu gostaria de ser:
NE234GJKLKU,*(978)-9098
NE345HJsdfe,*(153)-4656
YBKJNJKHBKK,*(198)-7654
UTGHNKOIUYO,*(112)-3421
ERTYUIJHGLK,*(145)-6666
Alguma sugestão?
tente sed
sed -r -e 's/\^//g;s/^.{13}/&(/;s/^.{17}/&)-/' file
NE234GJKLKU,*(978)-9098
NE345HJsdfe,*(153)-4656
YBKJNJKHBKK,*(198)-7654
UTGHNKOIUYO,*(112)-3421
ERTYUIJHGLK,*(145)-6666
Acho que isso funcionará:
sed -E 's/(.)\^(..)/()-/' file
Outra solução sed
:
$ sed 's,*,*(,g' FILE | sed -E 's,([0-9])\^([b0-9])([0-9]),)-,g'
NE234GJKLKU,*(978)-9098
NE345HJsdfe,*(153)-4656
YBKJNJKHBKK,*(198)-7654
UTGHNKOIUYO,*(112)-3421
ERTYUIJHGLK,*(145)-6666
Linha única:
$ sed -E 's,\*,*(,g;s,([0-9])\^([b0-9])([0-9]),)-,g' FILE
NE234GJKLKU,*(978)-9098
NE345HJsdfe,*(153)-4656
YBKJNJKHBKK,*(198)-7654
UTGHNKOIUYO,*(112)-3421
ERTYUIJHGLK,*(145)-6666
Tags text-processing