Sponsored Content
Top Forums Shell Programming and Scripting [SOLVED] Converting data from one format to the other Post 302742751 by rdrtx1 on Tuesday 11th of December 2012 01:53:49 PM
Old 12-11-2012
try:
Code:
awk '
BEGIN {
  OFS="\t";
  print "family","rep","generation","gene","value";
}
/generation/ {for (i=2; i<=NF; i++) gn[i]=$i; next;}
$1 == "gene" {fm=$2; sub("-[^-]*$","",fm);
  par=fm;
  sub("-.*","", par);
  for (i=2; i<=NF; i++) {
    if ($i ~ /Par/) {gn[i]=$i; sub("-.*","",gn[i]);}
    sub(".*_","",$i);rp[i]=$i
  }; next;
}
{ for (i=2; i<=NF; i++ ) {
   print fm, rp[i], gn[i], $1, $i;
  }
}
' OFS="\t" input

This User Gave Thanks to rdrtx1 For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

converting a tabular format data to comma seperated data in KSH

Hi, Could anyone help me in changing a tabular format output to comma seperated file pls in K-sh. Its very urgent. E.g : username empid ------------------------ sri 123 to username,empid sri,123 Thanks, Hema:confused: (2 Replies)
Discussion started by: Hemamalini
2 Replies

2. Shell Programming and Scripting

Converting windows format file to unix format using script

Hi, I am having couple of files which i used to copy from windows to Linux, so now in case of text files (CTRL^M) appears at end of line. I know i can convert this windows format file to unix format file by running dos2unix. My requirement here is that i want to do it automatically using a... (5 Replies)
Discussion started by: sarbjit
5 Replies

3. Shell Programming and Scripting

Converting the date format

Hi All, I am new to this forum. Could anyone help me to resolve the following issue. Input of the flat file contains several lines of text for example find below: 5022090,2,4,7154,88,,,,,4/1/2011 0:00,Z,L,2 5022090,3,1,6648,88,,,,,4/1/2011 0:00,Z,,1 5022090,4,1,6648,88,,,,,4/1/2011... (6 Replies)
Discussion started by: av_sagar
6 Replies

4. Shell Programming and Scripting

Converting variable space width data into CSV data in bash

Hi All, I was wondering how I can convert each line in an input file where fields are separated by variable width spaces into a CSV file. Below is the scenario what I am looking for. My Input data in inputfile.txt 19 15657 15685 Sr2dReader 107.88 105.51... (4 Replies)
Discussion started by: vharsha
4 Replies

5. Shell Programming and Scripting

[Solved] Converting the data into matrix with 0's and 1's

I have a file that contains 2 columns tag,pos cat input_file tag pos atg 10 ata 16 agt 15 agg 19 atg 17 agg 14 I have used following command to sort the file based on second column sort -k 2 input_file tag pos atg 10 agg 14 agt 15 ata 16 agg 19 atg 17 (2 Replies)
Discussion started by: raj_k
2 Replies

6. Shell Programming and Scripting

Converting text files to xls through awk script for specific data format

Dear Friends, I am in urgent need for awk/sed/sh script for converting a specific data format (.txt) to .xls. The input is as follows: >gi|1234|ref| Query = 1 - 65, Target = 1677 - 1733 Score = 8.38, E = 0.6529, P = 0.0001513, GC = 46 fd sdfsdfsdfsdf fsdfdsfdfdfdfdfdf... (6 Replies)
Discussion started by: Amit1
6 Replies

7. Shell Programming and Scripting

Need help in converting the file format

Hi All, I need help in converting the mentioned file format into desired output format using awk. Could anyone help me in this? Below is the input.. Date Account Campaign AdGroup Keyword Conversion Revenue Var1 Var2 Var3 Var4 Var5 10 20 30 ... (8 Replies)
Discussion started by: Ravi S M
8 Replies

8. Programming

Visual Basic converting a decimal data type to a label with currency format

Here is the code that I am working with. I have tried several other things. any suggestions? Lbl_Cost_Output.Text = (dDistance * dCostPerMile).ToString("C") The label is formatted correctly in terms of value 0.00 but no dollar sign appears. Please let me know if you have any questions. (1 Reply)
Discussion started by: briandanielz
1 Replies

9. Shell Programming and Scripting

Converting another line to another format

Hi there, How can i shorten this: grep -ri "Password must meet complexity requirements" "$line" | sed 's/\t/<\/td><td>/' | sed 's/^.*:/<tr><td>/'| sed 's/$/<\/td><\/tr>/' I am looking for a shorter alternative of sed. What I was trying to do is to change the string output format from ... (3 Replies)
Discussion started by: alvinoo
3 Replies

10. UNIX for Dummies Questions & Answers

Converting unstructured data to structured data

Hi, Can someone help in converting the below unstructured data to a CSV format please. { "branchId" : "BNSFGDJNSJG-73264HB-132131BNHJFSDG", "branchName" : "NEWYORK-SSDF", "branchProductId" : "72Y5HFHSF7H3RUNAWEF", "PreferenceId" : "BASDBVcbzcYHcb", "emailId" :... (9 Replies)
Discussion started by: naveen.kuppili
9 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 01:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy