Sponsored Content
Top Forums UNIX for Advanced & Expert Users Convert column data to row data using shell script Post 302650983 by migurus on Monday 4th of June 2012 04:15:36 PM
Old 06-04-2012
tr command is very handy, man tr and check all the features.
As a simplistic example:

Code:
$ echo "Col1 Col2 Col3"
Col1 Col2 Col3
$
$ echo "Col1 Col2 Col3" | tr ' ' '\n'
Col1
Col2
Col3
$

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to insert data befor some field in a row of data depending up on values in row

Hi I need to do some thing like "find and insert before that " in a file which contains many records. This will be clear with the following example. The original data record should be some thing like this 60119827 RTMS_LOCATION_CDR INSTANT_POSITION_QUERY 1236574686123083rtmssrv7 ... (8 Replies)
Discussion started by: aemunathan
8 Replies

2. Shell Programming and Scripting

Convert row data to column data

Hi Guys, I have a file as follows: a 1 b 786 c 90709 d 99 a 9875 b 989 c 887 d 111 I want: a 1 9875 b 786 989 (3 Replies)
Discussion started by: npatwardhan
3 Replies

3. Shell Programming and Scripting

How to convert 2 column data into multiple columns based on a keyword in a row??

Hi Friends I have the following input data in 2 columns. SNo 1 I1 Value I2 Value I3 Value SNo 2 I4 Value I5 Value I6 Value I7 Value SNo 3 I8 Value I9 Value ............... ................ SNo N (1 Reply)
Discussion started by: ks_reddy
1 Replies

4. Shell Programming and Scripting

row to column and position data in to fixed column width

Dear friends, Below is my program and current output. I wish to have 3 or 4 column output in order to accomodate in single page. i do have subsequent command to process after user enter the number. Program COUNT=1 for MYDIR in `ls /` do VOBS=${MYDIR} echo "${COUNT}. ${MYDIR}" ... (4 Replies)
Discussion started by: baluchen
4 Replies

5. Shell Programming and Scripting

Convert XML to Data File in Shell Script

Hi All, I will be getting a huge XML file with a lot of records in it. I need to convert it into multiple data files. SAMPLE XML FILE <ABSProductCatalog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <ProductSalesHierachy> - <Portfolios> - <Portfolio productCode="P1"> ... (8 Replies)
Discussion started by: ragha81
8 Replies

6. Shell Programming and Scripting

Moving data from a specified column/row to another column/row

Hello, I have an input file like the following: 11_3_4 2_1_35 3_15__ _16989 Where '_' is a space. The data is in a table. Is there a way for the program to prompt the user for x1,y1 and x2,y2, where x1,y1 is the desired number (for example x=6 y=4 is a value of 4) and move to a desired spot... (2 Replies)
Discussion started by: jl487
2 Replies

7. Shell Programming and Scripting

By using AWK can I convert matrice shaped data to a row ?

Hello, I have output in the matrice form , for example: 1 2 3 4 a b c d jim joe sue tom how can I convert this line-column data into a row as follows 1 2 3 4 a b c d jim joe sue tom thank you (14 Replies)
Discussion started by: rpf
14 Replies

8. Shell Programming and Scripting

awk - script help: column to row format of data allignment?

Experts Good day, I have the following data, file1 BRAAGRP1 A2X B2X C2X D2X BRBGRP12 A3X B3X Z10 D09 BRC1GRP2 LO01 (4 Replies)
Discussion started by: rveri
4 Replies

9. Shell Programming and Scripting

Convert Data from Column to Row

Hi FileA.txt E_TIM 16, ETE 15, EOND 26, EEC 81, E_1 un, E_2 un, E_3 un, E_4 284, E_TIM 17, ETE 15, EOND 29, EEC 82, E_1 un, E_2 un, E_3 un, E_4 249, (6 Replies)
Discussion started by: asavaliya
6 Replies

10. UNIX for Beginners Questions & Answers

How to insert data into black column( Secound Column ) in excel (.XLSX) file using shell script?

Source Code of the original script is down below please run the script and try to solve this problem this is my data and I want it column wise 2019-03-20 13:00:00:000 2019-03-20 15:00:00:000 1 Operating System LAB 0 1 1 1 1 1 1 1 1 1 0 1 (5 Replies)
Discussion started by: Shubham1182
5 Replies
Text::SimpleTable(3pm)					User Contributed Perl Documentation				    Text::SimpleTable(3pm)

NAME
Text::SimpleTable - Simple Eyecandy ASCII Tables SYNOPSIS
use Text::SimpleTable; my $t1 = Text::SimpleTable->new(5, 10); $t1->row('foobarbaz', 'yadayadayada'); print $t1->draw; .-------+------------. | foob- | yadayaday- | | arbaz | ada | '-------+------------' my $t2 = Text::SimpleTable->new([5, 'Foo'], [10, 'Bar']); $t2->row('foobarbaz', 'yadayadayada'); $t2->row('barbarbarbarbar', 'yada'); print $t2->draw; .-------+------------. | Foo | Bar | +-------+------------+ | foob- | yadayaday- | | arbaz | ada | | barb- | yada | | arba- | | | rbar- | | | bar | | '-------+------------' my $t3 = Text::SimpleTable->new([5, 'Foo'], [10, 'Bar']); $t3->row('foobarbaz', 'yadayadayada'); $t3->hr; $t3->row('barbarbarbarbar', 'yada'); print $t3->draw; .-------+------------. | Foo | Bar | +-------+------------+ | foob- | yadayaday- | | arbaz | ada | +-------+------------+ | barb- | yada | | arba- | | | rbar- | | | bar | | '-------+------------' DESCRIPTION
Simple eyecandy ASCII tables. METHODS
Text::SimpleTable implements the following methods. "new" my $t = Text::SimpleTable->new(5, 10); my $t = Text::SimpleTable->new([5, 'Col1', 10, 'Col2']); "draw" my $ascii = $t->draw; "hr" $t = $t->hr; "row" $t = $t->row('col1 data', 'col2 data'); AUTHOR
Sebastian Riedel, "sri@cpan.org". CREDITS
In alphabetical order: Brian Cassidy COPYRIGHT
Copyright (C) 2005-2009, Sebastian Riedel. This program is free software, you can redistribute it and/or modify it under the same terms as Perl 5.10. perl v5.10.0 2009-07-03 Text::SimpleTable(3pm)
All times are GMT -4. The time now is 01:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy