reconstruct phone numbers

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
-1
down vote

favorite












I have script that extract phone numbers from an old file. The numbers are similar to these



7564329876
5663456789
5665677652
3788764564
5658762344
5655672345
3443457655
2323567899
5433454567
3243453456


they should be in this form (xxx) xxx-xxxx what I should do to get this result?



(756) 432-9876
(566) 345-6789
(566) 567-7652
(378) 876-4564
(565) 876-2344
(565) 567-2345
(344) 345-7655
(232) 356-7899
(543) 345-4567
(324) 345-3456








share























  • Possible duplicate of Formatting phone number column
    – Jeff Schaller
    5 mins ago










  • also unix.stackexchange.com/questions/95926/…
    – Jeff Schaller
    5 mins ago










  • See also: unix.stackexchange.com/q/441676/117549
    – Jeff Schaller
    4 mins ago










  • @JeffSchaller I am so sorry about that, I didn't see those! honestly I didn't even Google for it. I greatly apologizes!
    – Shervan
    1 min ago














up vote
-1
down vote

favorite












I have script that extract phone numbers from an old file. The numbers are similar to these



7564329876
5663456789
5665677652
3788764564
5658762344
5655672345
3443457655
2323567899
5433454567
3243453456


they should be in this form (xxx) xxx-xxxx what I should do to get this result?



(756) 432-9876
(566) 345-6789
(566) 567-7652
(378) 876-4564
(565) 876-2344
(565) 567-2345
(344) 345-7655
(232) 356-7899
(543) 345-4567
(324) 345-3456








share























  • Possible duplicate of Formatting phone number column
    – Jeff Schaller
    5 mins ago










  • also unix.stackexchange.com/questions/95926/…
    – Jeff Schaller
    5 mins ago










  • See also: unix.stackexchange.com/q/441676/117549
    – Jeff Schaller
    4 mins ago










  • @JeffSchaller I am so sorry about that, I didn't see those! honestly I didn't even Google for it. I greatly apologizes!
    – Shervan
    1 min ago












up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











I have script that extract phone numbers from an old file. The numbers are similar to these



7564329876
5663456789
5665677652
3788764564
5658762344
5655672345
3443457655
2323567899
5433454567
3243453456


they should be in this form (xxx) xxx-xxxx what I should do to get this result?



(756) 432-9876
(566) 345-6789
(566) 567-7652
(378) 876-4564
(565) 876-2344
(565) 567-2345
(344) 345-7655
(232) 356-7899
(543) 345-4567
(324) 345-3456








share















I have script that extract phone numbers from an old file. The numbers are similar to these



7564329876
5663456789
5665677652
3788764564
5658762344
5655672345
3443457655
2323567899
5433454567
3243453456


they should be in this form (xxx) xxx-xxxx what I should do to get this result?



(756) 432-9876
(566) 345-6789
(566) 567-7652
(378) 876-4564
(565) 876-2344
(565) 567-2345
(344) 345-7655
(232) 356-7899
(543) 345-4567
(324) 345-3456






text-formatting





share














share












share



share








edited 5 mins ago









Jeff Schaller

33.9k851113




33.9k851113










asked 8 mins ago









Shervan

34611




34611











  • Possible duplicate of Formatting phone number column
    – Jeff Schaller
    5 mins ago










  • also unix.stackexchange.com/questions/95926/…
    – Jeff Schaller
    5 mins ago










  • See also: unix.stackexchange.com/q/441676/117549
    – Jeff Schaller
    4 mins ago










  • @JeffSchaller I am so sorry about that, I didn't see those! honestly I didn't even Google for it. I greatly apologizes!
    – Shervan
    1 min ago
















  • Possible duplicate of Formatting phone number column
    – Jeff Schaller
    5 mins ago










  • also unix.stackexchange.com/questions/95926/…
    – Jeff Schaller
    5 mins ago










  • See also: unix.stackexchange.com/q/441676/117549
    – Jeff Schaller
    4 mins ago










  • @JeffSchaller I am so sorry about that, I didn't see those! honestly I didn't even Google for it. I greatly apologizes!
    – Shervan
    1 min ago















Possible duplicate of Formatting phone number column
– Jeff Schaller
5 mins ago




Possible duplicate of Formatting phone number column
– Jeff Schaller
5 mins ago












also unix.stackexchange.com/questions/95926/…
– Jeff Schaller
5 mins ago




also unix.stackexchange.com/questions/95926/…
– Jeff Schaller
5 mins ago












See also: unix.stackexchange.com/q/441676/117549
– Jeff Schaller
4 mins ago




See also: unix.stackexchange.com/q/441676/117549
– Jeff Schaller
4 mins ago












@JeffSchaller I am so sorry about that, I didn't see those! honestly I didn't even Google for it. I greatly apologizes!
– Shervan
1 min ago




@JeffSchaller I am so sorry about that, I didn't see those! honestly I didn't even Google for it. I greatly apologizes!
– Shervan
1 min ago










1 Answer
1






active

oldest

votes

















up vote
0
down vote













sed solution:



sed -r 's/.0/&(/;s/.4/&)/;s/.5/& /;s/.9/&-/' file

(756) 432-9876
(566) 345-6789
(566) 567-7652
(378) 876-4564
(565) 876-2344
(565) 567-2345
(344) 345-7655
(232) 356-7899
(543) 345-4567
(324) 345-3456




share




















  • Thank you for the answer and I apologies for not looking for previous answers! My bad.
    – Shervan
    14 secs ago










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f475330%2freconstruct-phone-numbers%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













sed solution:



sed -r 's/.0/&(/;s/.4/&)/;s/.5/& /;s/.9/&-/' file

(756) 432-9876
(566) 345-6789
(566) 567-7652
(378) 876-4564
(565) 876-2344
(565) 567-2345
(344) 345-7655
(232) 356-7899
(543) 345-4567
(324) 345-3456




share




















  • Thank you for the answer and I apologies for not looking for previous answers! My bad.
    – Shervan
    14 secs ago














up vote
0
down vote













sed solution:



sed -r 's/.0/&(/;s/.4/&)/;s/.5/& /;s/.9/&-/' file

(756) 432-9876
(566) 345-6789
(566) 567-7652
(378) 876-4564
(565) 876-2344
(565) 567-2345
(344) 345-7655
(232) 356-7899
(543) 345-4567
(324) 345-3456




share




















  • Thank you for the answer and I apologies for not looking for previous answers! My bad.
    – Shervan
    14 secs ago












up vote
0
down vote










up vote
0
down vote









sed solution:



sed -r 's/.0/&(/;s/.4/&)/;s/.5/& /;s/.9/&-/' file

(756) 432-9876
(566) 345-6789
(566) 567-7652
(378) 876-4564
(565) 876-2344
(565) 567-2345
(344) 345-7655
(232) 356-7899
(543) 345-4567
(324) 345-3456




share












sed solution:



sed -r 's/.0/&(/;s/.4/&)/;s/.5/& /;s/.9/&-/' file

(756) 432-9876
(566) 345-6789
(566) 567-7652
(378) 876-4564
(565) 876-2344
(565) 567-2345
(344) 345-7655
(232) 356-7899
(543) 345-4567
(324) 345-3456





share











share


share










answered 6 mins ago









Goro

8,96064486




8,96064486











  • Thank you for the answer and I apologies for not looking for previous answers! My bad.
    – Shervan
    14 secs ago
















  • Thank you for the answer and I apologies for not looking for previous answers! My bad.
    – Shervan
    14 secs ago















Thank you for the answer and I apologies for not looking for previous answers! My bad.
– Shervan
14 secs ago




Thank you for the answer and I apologies for not looking for previous answers! My bad.
– Shervan
14 secs ago

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f475330%2freconstruct-phone-numbers%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay