Converting Single Column into Multiple rows


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Converting Single Column into Multiple rows
# 1  
Old 10-11-2014
Converting Single Column into Multiple rows

Hi .. anyone can you help me ?
i need to convert text below into multiple columns

Code:
interface; GigabitEthernet0/0/0/0
 description; TRUNK_PE-D2-JT2-VPN_Gi0/0/0/0_TO_ME4-A-JKT-JT_4/1/1_1G
 mtu 9212
 negotiation auto

interface; GigabitEthernet0/0/0/0.11
 description; tes
 encapsulation; dot1q 11

interface; GigabitEthernet0/0/0/0.23
 description; VPNIP HALLIBURTON KUNINGAN CID 20550022 FMI 8860 SID 4700186-48623
 bandwidth; 4096
 service_policy_input; rate_limit_4M
 service_policy_output; rate_limit_4M
 vrf; V2244:Halliburton
 ipv4_address; 172.17.18.1 255.255.255.252
 encapsulation; dot1q 23

output columns

Code:
interface description bandwidth service_policy_input service_policy_ouput vrf ipv4_address encapsulation

GigabitEthernet0/0/0/0
GigabitEthernet0/0/0/0.11 tes                                                                                                                                    
GigabitEthernet0/0/0/0.23 VPNIP HALLIBURTON KUNINGAN CID 20550022 FMI 8860 SID 4700186-48623 4096 rate_limit_4M rate_limit_4M V2244:Halliburton 172.17.xx.x 255.255.255.2xx dot1q 23

thank's before ..

Last edited by Don Cragun; 10-11-2014 at 03:25 PM.. Reason: Add CODE tags.
# 2  
Old 10-11-2014
You really don't want to use space as a field separator when some of your fields contain spaces as data. You need to either quote fields in the output when data for that field contains your field delimiter or choose a different delimiter (common choices would be a comma or a tab).

With the input:
Code:
interface; GigabitEthernet0/0/0/0.11
 description; tes
 encapsulation; dot1q 11

why doesn't dot1q 11 appear in your desired output?:
Code:
GigabitEthernet0/0/0/0.11 tes

Please clarify how you want to address these issues.

Is this a homework assignment?

What have you tried?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Converting a single row to multiple rows

Hi, I want to convert a single row values to multiple rows, but the no. of rows are not fixed. For example, I have a row as below abc-def-lmn-mno-xyz out put should be get abc get def get lmn get xyz (4 Replies)
Discussion started by: Suneel Mekala
4 Replies

2. Shell Programming and Scripting

Convert single column into multiple rows

Convert Single column to multiple rows file a.txt contains data like below Server=abc Run=1 Tables=10 Sessions=16 Time=380 Jobs=5 Server=abc Run=2 Tables=15 Sessions=16 Time=400 Jobs=5 Server=abc Run=3 Tables=20 Sessions=16 Time=450 (5 Replies)
Discussion started by: sol_nov
5 Replies

3. Shell Programming and Scripting

Converting Single Column into Multiple rows, but with strings to specific tab column

Dear fellows, I need your help. I'm trying to write a script to convert a single column into multiple rows. But it need to recognize the beginning of the string and set it to its specific Column number. Each Line (loop) begins with digit (RANGE). At this moment it's kind of working, but it... (6 Replies)
Discussion started by: AK47
6 Replies

4. Shell Programming and Scripting

Transpose multiple rows (with a mix of space and enter) to a single column

How to change the uploaded weekly file data to the following format? New Well_Id,Old Well_Id,District,Thana,Date,Data,R.L,WellType,Lati.,Longi. BAG001,PT006,BARGUNA,AMTALI,1/2/1978,1.81,2.29,Piezometer,220825,901430 BAG001,PT006,BARGUNA,AMTALI,1/9/1978,1.87,2.29,Piezometer,220825,901430... (3 Replies)
Discussion started by: sara.nowreen
3 Replies

5. UNIX for Dummies Questions & Answers

[SOLVED] splitting a single column(with spaces) into multiple rows

Hi All, My requisite is to split a single column of phonemes seperated by spaces into multiple rows. my input file is: a dh u th a qn ch A v U r k my o/p should be like: adhu a dh u (3 Replies)
Discussion started by: girlofgenuine
3 Replies

6. Shell Programming and Scripting

How to merge multiple rows into single row if first column matches ?

Hi, Can anyone suggest quick way to get desired output? Sample input file content: A 12 9 A -0.3 2.3 B 1.0 -4 C 34 1000 C -111 900 C 99 0.09 Output required: A 12 9 -0.3 2.3 B 1.0 -4 C 34 1000 -111 900 99 0.09 Thanks (3 Replies)
Discussion started by: cbm_000
3 Replies

7. Shell Programming and Scripting

Converting Multiple rows to Single Row using unix commands

Can somebody help me in solving this.. Input data is like 0 A 1 B 2 C 3 D 0 A1 1 B1 2 C1 3 D1 0 A2 1 B2 2 C2 3 D2 Output should be like A B C D A1 B1 C1 D1 A2 B2 C2 D2 (7 Replies)
Discussion started by: Mahantesh Patil
7 Replies

8. UNIX for Advanced & Expert Users

Converting rows to a single row

Hi all I have a file as below : Development System User Production i want to convert the file to below format: "Development","System","User","Production" Is it possible with UNIX ? if so can you please give me some direction on it ? Thanks, Satya Use code tags please, ty. (10 Replies)
Discussion started by: satyaranjon
10 Replies

9. Shell Programming and Scripting

Single column into multiple rows

Hi all, I need to convert this file having just one column into two column file current file: a 15 b 21 c 34 d 48 e 10 wanted: a 15 b 21 c 34 (15 Replies)
Discussion started by: prachiagra
15 Replies

10. Shell Programming and Scripting

Converting Single Column into Multiple rows

i have single column which is starting with same string(many number of rows) i have to convert each into a single row.how can i do that? laknar std mes 23 55 laknar isd phone no address amount 99 I have to convert above like below. laknar|std|mes|23|55 laknar|isd|phone... (3 Replies)
Discussion started by: laknar
3 Replies
Login or Register to Ask a Question