Sponsored Content
Top Forums UNIX for Advanced & Expert Users Converting rows to a single row Post 302422033 by Tytalus on Monday 17th of May 2010 09:49:42 AM
Old 05-17-2010
several ways....

one way

Code:
#   echo $(cat infile) | sed -e 's/\(.*\)/\"\1\"/' -e 's/ /\",\"/g'
"Development","System","User","Production"

another:

Code:
#  s="\"";while read t; do s=$s",\""$t\"; done < infile ; echo $s | cut -c3-
"Development","System","User","Production"

or

Code:
#  awk '{t[NR]=$0}END{for (i=2;i<NR;i++){s=s"\""t[i]"\","};print "\""t[1]"\","s"\""t[NR]"\""}' infile 
"Development","System","User","Production"

Sure their are easier ways of doing it also :-) hope this gives you some ideas to play with though..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Converting Column values to comma delimted single Row

I have a requirement in which i have to read a file which has multiple columns seperated by a pipe "|" from this i have to read each column values seperately and create a comma seperated row for the column and write to another file. eg: Input file: ColA ColB 1 2 2 x 3 y... (5 Replies)
Discussion started by: nvuradi
5 Replies

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

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

Combining multiple rows in single row based on certain condition using awk or sed

Hi, I'm using AIX(ksh shell). > cat temp.txt "a","b",0 "c",bc",0 "a1","b1",0 "cc","cb",1 "cc","b2",1 "bb","bc",2 I want the output as: "a","b","c","bc","a1","b1" "cc","cb","cc","b2" "bb","bc" I want to combine multiple lines into single line where third column is same. Is... (1 Reply)
Discussion started by: samuelray
1 Replies

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

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

Shell Code required -Output in Multiple Rows to be in single row separated by Commas -

Hola Greetings Experts , I have records spreaded across multiple lines. in attached log.txt i want output to be in 1 line like this below Atached as Output.txt. In brief Output related to 1 line is spreaded across multiple row I wanted it to be in 1 row . Please opem the file in notepad... (4 Replies)
Discussion started by: manishK
4 Replies

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

9. Shell Programming and Scripting

Converting Single Column into Multiple rows

Hi .. anyone can you help me ? i need to convert text below into multiple columns 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;... (1 Reply)
Discussion started by: mad3linux
1 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
deckorean(5)							File Formats Manual						      deckorean(5)

NAME
deckorean - A character encoding system (codeset) for Korean DESCRIPTION
The DEC Korean (deckorean) codeset consists of the following character sets: ASCII KSC 5601-1987 For the symbols and ideographic characters defined in the KSC 5601-1987 character set, DEC Korean uses 2-byte data representation. For ASCII characters, DEC Korean uses single-byte 7-bit data representation; that is, the most significant bit (MSB) of the byte that repre- sents an ASCII character value is always set off. For more information on the ASCII character set, refer to ascii(5). KSC 5601-1987 Characters KSC 5601-1987 is a national standard that defines a primary set of graphic characters for Korean information interchange. The standard defines a character set with a total of 8224 characters that are arranged in a code table. The code table has 94 rows, numbered from 1 to 94. Each row has 94 columns, also numbered from 1 to 94. Different kinds of characters occupy different areas of the code table as follows: Special characters: 986 graphic symbols that reside in rows 1 to 12 Hangul characters: 2350 Korean (Hangul) characters that reside in rows 16 to 40 Hanja characters: 4888 Chinese characters that reside in rows 42 to 93 DEC Korean Encoding Values To differentiate KSC 5601-1987 codes from ASCII codes, the most significant bit (MSB) of both the first and the second byte of a KSC 5601 character value is always set on. The value of a KSC 5601 character can be determined from its row and column number as follows: 1st byte = A0 + Row number 2nd byte = A0 + Column number For example, if a character is positioned at the first column of the 36th row, its value is CA41, which is calulated as follows: 1st byte = A0(hex) + 36 = C4 (hex) 2nd byte = A0(hex) + 01 = A1 (hex) Codeset Conversion The following codeset converter pairs are available for converting Korean characters between deckorean and other encoding formats. Refer to iconv_intro(5) for an introduction to codeset conversion. For more information about the other codeset for which deckorean is the input or output, see the reference page specified in the list item. eucKR_deckorean, deckorean_eucKR Converting from and to Korean Extended UNIX Code: eucKR(5). UCS-2_deckorean, deckorean_UCS-2 Converting from and to UCS-2 format: Unicode(5). UCS-4_deckorean, deckorean_UCS-4 Converting from and to UCS-4 format: Unicode(5). UTF-8_deckorean, deckorean_UTF-8 Converting from and to UTF-8 format: Unicode(5). There are also codeset converters that convert between the Microsoft Korean code-page format (cp949) used on PC systems and UCS-2, UCS-4, and UTF-8 formats. Note that if the UCS-2, UCS-4, or UTF-8 output from these converters is then converted to DEC Korean, some Hangul char- acters may be lost. For more information, see code_page(5). DEC Korean Fonts The operating system provides Korean fonts for both screen display and printers. The following bitmap fonts are available in various sizes and typefaces for 75dpi and 100dpi display devices: Fonts in Gotic Family: -adecw-gotic-medium-r-normal--16-160-75-75-m-160-ksc5601.1987-1 -adecw-gotic-medium-r-normal--24-240-75-75-m-240-ksc5601.1987-1 -adecw-gotic-medium-r-normal--16-160-100-100-m-160-ksc5601.1987-1 -adecw-gotic-medium-r-normal--24-240-100-100-m-240-ksc5601.1987-1 Fonts in Myungcho Family: -adecw-myungcho-medium-r-normal--16-160-75-75-m-160-ksc5601.1987-1 -adecw-myungcho-medium-r-nor- mal--32-320-75-75-m-320-ksc5601.1987-1 -adecw-myungcho-medium-r-normal--24-240-75-75-m-240-ksc5601.1987-1 -adecw-myungcho-medium-r- normal--16-160-100-100-m-160-ksc5601.1987-1 -adecw-myungcho-medium-r-normal--24-240-100-100-m-240-ksc5601.1987-1 -adecw-myungcho- medium-r-normal--32-320-100-100-m-320-ksc5601.1987-1 Fonts in Screen Family: -adecw-screen-medium-r-normal--18-180-75-75-m-160-ksc5601.1987-1 -adecw-screen-medium-r-normal--24-240-75-75-m-240-ksc5601.1987-1 -adecw-screen-medium-r-normal--18-180-100-100-m-160-ksc5601.1987-1 -adecw-screen-medium-r-nor- mal--24-240-100-100-m-240-ksc5601.1987-1 -adecw-screen-medium-r-normal--18-180-100-100-m-160-ksc5601.1987-1 -adecw-screen-medium-r- normal--24-240-100-100-m-240-ksc5601.1987-1 For PostScript printers, the operating system provides only Munjo fonts. For general information on printing non-English text, refer to i18n_printing(5). SEE ALSO
Commands: locale(1) Others: ascii(5), code_page(5), i18n_intro(5), i18n_printing(5), iconv_intro(5), l10n_intro(5), eucKR(5), Korean(5), Unicode(5) deckorean(5)
All times are GMT -4. The time now is 03:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy