LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Dividing a line into two colums (https://www.linuxquestions.org/questions/programming-9/dividing-a-line-into-two-colums-584411/)

talat 09-13-2007 09:27 AM

Dividing a line into two colums
 
Hi Guys

Consider i have a file with similar type of values e.g

talat@hotmail.comagsggss
talat@gmail.comhjhdhjdk

i want to separate the email id and value after that in to two column so that when i open this file in excel it automatically goes in separate columns .I have tried adding space after email id but no luck.Any clue ?

Regard
Talat

95se 09-13-2007 09:31 AM

Comma separated values to the rescue: http://en.wikipedia.org/wiki/Comma-separated_values

dgar 09-13-2007 10:55 AM

cat old.txt | sed 's?^\([^@ ]*@[^\. @]*\.[^\. @]*\)\(.*\)$?\1,\2?' > out.txt

I'll be amazed if it works, that's off the cuff regex.


All times are GMT -5. The time now is 12:29 AM.