LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-13-2007, 09:27 AM   #1
talat
Member
 
Registered: Jan 2006
Distribution: Centos
Posts: 145

Rep: Reputation: 16
Question 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
 
Old 09-13-2007, 09:31 AM   #2
95se
Member
 
Registered: Apr 2002
Location: Windsor, ON, CA
Distribution: Ubuntu
Posts: 740

Rep: Reputation: 32
Comma separated values to the rescue: http://en.wikipedia.org/wiki/Comma-separated_values
 
Old 09-13-2007, 10:55 AM   #3
dgar
Member
 
Registered: Jun 2005
Location: Candia, NH
Distribution: Ubuntu, FC, RHE3, RHE4, CentOS
Posts: 121

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

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I need to tail -f just a few colums o a text file ericcarlson Linux - General 3 01-30-2007 03:07 PM
Dividing Videos files kheno Linux - General 0 02-04-2005 08:57 PM
Dividing a NTFS partition Plice Slackware 3 10-04-2004 03:02 PM
Echoing the first and last colums of a textfile ganninu Linux - General 4 06-26-2004 05:54 AM
dividing screens in x flow777bee Linux - Software 2 06-23-2004 10:19 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration