Sponsored Content
Top Forums Shell Programming and Scripting Convert columns to single row Post 302426712 by vasuarjula on Wednesday 2nd of June 2010 04:53:05 PM
Old 06-02-2010
Convert columns to single row

Hello all

I have data like

Code:
1
2
3
4
5

I wish my output would be like

Code:
1,2,3,4,5

For this i have executed
Code:
'BEGIN {FS="\n"; ORS=","} {print $0}' test

and got the output as
Code:
1,2,3,4,5,

I do not want to have , at the end of 5. output should be like
Code:
1,2,3,4,5

If the input is
Code:
1
2
3

then output should be like 1,2,3

Please reply

Last edited by Scott; 06-02-2010 at 06:02 PM.. Reason: Please use code tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to convert a single column into several rows and columns?

I have a program which gives me the output as a single column with hundreds of rows like: 213 314 324 324 123 I want to be able to create a new file from this file which allows me to set the number of rows and columns in the new file, i.e. for this example, if I specify 3 rows and 2... (5 Replies)
Discussion started by: ashton_smith
5 Replies

2. UNIX for Dummies Questions & Answers

convert matrix to row and columns

Dear Unix Gurus, I have a sample data set that looks like this y1 y2 y3 y4 y5 x1 0.3 0.5 2.3 3.1 5.1 x2 1.2 4.1 3.5 1.7 1.2 x3 3.1 2.1 1.0 4.1 2.1 x4 5.0 4.0 6.0 7.0 1.1 I want to open it up so that I get x1 y1 0.3 x2 y1 1.2 x3 y1 3.1 x4 y1 5.0 x1 y2 0.5 x2 y2... (3 Replies)
Discussion started by: tintin72
3 Replies

3. UNIX for Advanced & Expert Users

convert rows to single row

Hi I want to convert multiple rows ro single row ,I have tried with below one but I am not getting what I am expecting.Please any idea a.txt conn1=stg conn2=dev path=\xxx\a1.txt fre=a conn1=stg conn2=dev path=\xxx\a2.txt freq=a awk '/a/{ORS=" "}{print}END{print "\n"}'... (5 Replies)
Discussion started by: akil
5 Replies

4. 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

5. Shell Programming and Scripting

How to convert a single column into several columns?

Hi I have a ksh script which gives me the output as a single column with several rows like: AAA BBB CCC DDD EEE FFF GGG HHH III I want to be able to create a new file from this file which allows me to set the number of rows and columns in the new file, i.e. for this example, if I... (30 Replies)
Discussion started by: pinpe
30 Replies

6. Shell Programming and Scripting

Subtracting each row from the first row in a single column file using awk

Hi Friends, I have a single column data like below. 1 2 3 4 5 I need the output like below. 0 1 2 3 4 where each row (including first row) subtracting from first row and the result should print below like the way shown in output file. Thanks Sid (11 Replies)
Discussion started by: ks_reddy
11 Replies

7. UNIX for Dummies Questions & Answers

Select 2 columns and transpose row by row

Hi, I have a tab-delimited file as follows: 1 1 2 2 3 3 4 4 a a b b c c d d 5 5 6 6 7 7 8 8 e e f f g g h h 9 9 10 10 11 11 12 12 i i j j k k l l 13 13 14 14 15 15 16 16 m m n n o o p p The output I need is: 1 1 a a 5 5 e e 9 9 i i 13... (5 Replies)
Discussion started by: mvaishnav
5 Replies

8. Shell Programming and Scripting

Convert columns to row using awk

Hi I need to convert some columns form a html file to rows. I do manage to make it works without help (some proud :) ) For some reason the offline status is not in bold, so I do need to remove the <b> tag from the other field to make this to work. All fields are not needed, so I test and... (5 Replies)
Discussion started by: Jotne
5 Replies

9. Shell Programming and Scripting

Convert row to columns start from nth column

Dear All, We have input like this: 161 57 1378 176 1392 262 1444 441 1548 538 1611 670 1684 241 57 1378 208 1393 269 1447 444 1549 538 1610 677 1700 321 ... (4 Replies)
Discussion started by: attila
4 Replies

10. Shell Programming and Scripting

Splitting single row into multiple rows based on for every 10 digits of last field of the row

Hi ALL, We have requirement in a file, i have multiple rows. Example below: Input file rows 01,1,102319,0,0,70,26,U,1,331,000000113200000011920000001212 01,1,102319,0,1,80,20,U,1,241,00000059420000006021 I need my output file should be as mentioned below. Last field should split for... (4 Replies)
Discussion started by: kotra
4 Replies
KUIPC(1)						      General Commands Manual							  KUIPC(1)

NAME
kuipc - the CERN KUIP compiler SYNOPSIS
kuipc [ options ] [ inputfile [ outputfile ] ] DESCRIPTION
kuipc, the Kit for a User Interface Package Compiler, is a tool to simplify the writing of a program's user interface code. It takes as input a Command Definition File (CDF) that describes the commands to be understood by the program, and outputs C or FORTRAN code that makes the appropriate function calls to set up the user interface. This code can then be compiled and linked with the rest of the program. Since the generated code uses KUIP routines, the program must also be linked against the Packlib library that contains them. If no output file is specified, kuipc will output generated code to a file whose name is the same as the input file's, with the ending '.cdf' replaced by '.f' or '.c' as appropriate. If neither input nor output file are given, kuipc will prompt for them. Be careful because kuipc overwrites existing files with no warning. OPTIONS
-c Generate C code. -f Generate FORTRAN code (the default). -split Output several files, one for each time the >Name control line is used in the CDF input. The names of the output files will corre- spond to the arguments given on the >Name control lines. SEE ALSO
The KUIP manual: http://wwwasdoc.web.cern.ch/wwwasdoc/psdir/kuip.ps.gz BUGS
When the -split option is used, kuipc will still create an output file that it would have made if -split was not used; the file will be of zero size. AUTHOR
This manual page was written by Kevin McCarty <kmccarty@debian.org> for the Debian GNU/Linux system (but may be used by others). April 2, 2004 KUIPC(1)
All times are GMT -4. The time now is 07:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy