Separate into columns


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Separate into columns
# 1  
Old 08-11-2012
Separate into columns

Hi all

I have following kind of data in a file but non separated


Code:
ESR1 PA156 leflunomide PA450192 
CHST3 PA26503  docetaxel tungstate  Pa4586; thalidomide Pa34958;

I want to separate entries into columns so that I can put into excel sheet in proper arrangement.

I want entries starting PAxxx/PAxxxx in a columns

so that for first row I will have entries arranged in 4 columns

and for second row I will have entries in 6 columns

Expected output in columns thats it


Code:
ESR1 PA156 leflunomide PA450192 
CHST3 PA26503  docetaxel tungstate  Pa4586; thalidomide Pa34958;


Last edited by manigrover; 08-11-2012 at 04:48 AM..
# 2  
Old 08-11-2012
Although its not very clear to me what you've asked but this is what I can recommend to you.

I can already see that in your original text there are spaces. So, you can use the import wizard in Excel to import the contents into your excel sheet.
# 3  
Old 08-11-2012
Hi Shoaib

Thanks for reply

Yes I tried to separate columns based on space but its not wrking properly as for example there is space between "docetaxel tungstate" which shuld come in one column, but if we separate by space it will get separated which I do not want in output.

so the only thing I can see id PAxxx entries , if these entries get separated into columns other entries will be in column automatically which I want in output.

so for first row there will be 4 columns
and second row 6 columns


Code:
ESR1 PA156 leflunomide PA450192 
CHST3 PA26503  docetaxel tungstate  Pa4586; thalidomide Pa34958;

# 4  
Old 08-11-2012
One way could be to put underscore between the words appearing between PAxxx's and then import in Excel and in Excel find and replace all underscores with spaces.
# 5  
Old 08-11-2012
Request to check

Thankyou

Could u please advise me regarding script which can help me to put underscore between PA entries as there are some places ; sign present.

Kindly advise me regardin script as I think I shuld first remove ; sign and then put underscore

I just need guidance regarding underscore between PAxxx/PAxxxx entries

Thanks
Mani
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to use "awk" to print columns from different files in separate columns?

Hi, I'm trying to copy and paste the sixth column from a bunch of files into a single file having each column pasted in separate columns (and not one after each other in just one column.) I tried this code but works only partially because it copied and pasted 50 rows of each column... (6 Replies)
Discussion started by: Frastra
6 Replies

2. Shell Programming and Scripting

Separate columns into different text files

Hi I have large text file consisting of five columns. Sample of the file is give below: ed 2-4 12.0 commons that they depended on. मानवों नष्ट किया जिन पर वो आधारित थे। ed 3-1 12.0 Almost E, but would be over. रचना करीब करीब ई तक जाती है, मगर तब तो नाटक ख़त्म हो... (2 Replies)
Discussion started by: my_Perl
2 Replies

3. Shell Programming and Scripting

How to parse parts of 1 column into two separate columns?

I have a shell script that is currently transferring a csv file from a server into a Teradata database table. One of the 30 or so columns is called "destination_url". In that URL there are parameters, and it is possible for those parameters to be repeated because of referring companies copying... (3 Replies)
Discussion started by: craigwg
3 Replies

4. UNIX for Dummies Questions & Answers

How to generate one long column by merging two separate two columns in a single file?

Dear all, I have a simple question. I have a file like below (separated by tab): col1 col2 col3 col4 col5 col6 col7 21 66745 rs1234 21 rs5678 23334 0.89 21 66745 rs2334 21 rs9978 23334 0.89 21 66745 ... (4 Replies)
Discussion started by: forevertl
4 Replies

5. UNIX for Dummies Questions & Answers

Intersect of two columns in two separate files

Hi, I have a file like this: abc def ghi jkl mno My second file is like this (tab delimited): adsad sdfsdf dfdf wads abc dfdsf sdsf jkl sfsdf dsfds sdfd reor zxczd dsf sff Now, I want the code to report the lines (from file2) which have common strings in column 2 with the first... (4 Replies)
Discussion started by: a_bahreini
4 Replies

6. UNIX for Dummies Questions & Answers

Concatenate two columns and separate by - (minus)

hi all could you please help me to concatenate two colomns and separate them by "-" the two colomns to concatenate are colomuns 1 and 3 of a very bif file clomn 1 is chr, 2 is snp and 3 is bp the new colomn is chr_B input file : 1 rs1111 10583 1 rs1891 10611 1 rs1807 ... (13 Replies)
Discussion started by: biopsy
13 Replies

7. Shell Programming and Scripting

Remove brackets repeats and separate in columns

Hi all, I want to remove the remove bracket sign ( ) and put in the separate column I also want to remove the repeated entry like in first row in below input (PA156) is repeated ESR1 (PA156) leflunomide (PA450192) (PA156) leflunomide (PA450192) CHST3 (PA26503) docetaxel... (4 Replies)
Discussion started by: manigrover
4 Replies

8. Shell Programming and Scripting

Comparing columns in two separate files

Hey all, I have a file structure that looks something like this: file1 306708278 88954535 234167885 file2 2012-03-27T12:32:56+00:00 137 Orchotorena 184616310003601409 306708278 es 40.4777947 Majadahonda -3.6416896333333333 0 false atlante83 "<a href=""http://tapbots.com/tweetbot""... (8 Replies)
Discussion started by: dgaff
8 Replies

9. Shell Programming and Scripting

Extracting columns from a matrix and storing each column in a separate file

Hi All, I have a huge matrix file consisting some some millions rows and 6000 columns. The contents are just floating point numbers in the matrix. I want to extract each column (i.e. 6000 of them) and store each column in a separate file. For example, 1.dat will consist of elements from column... (4 Replies)
Discussion started by: shoaibjameel123
4 Replies

10. Shell Programming and Scripting

displaying 3 directory listings in 3 separate columns.

i having problems figuring out how to 'read' in 3 different directory listings and then display them on the screen into 3 separate columns. i thought i could use a 'for' loop to grab each directory and then assign a unique variable to each line 'read' in. of course, as you experts all know,... (16 Replies)
Discussion started by: mjays
16 Replies
Login or Register to Ask a Question