Sponsored Content
Top Forums Shell Programming and Scripting Transpose info that is within blocks Post 302611977 by Scrutinizer on Saturday 24th of March 2012 05:43:23 AM
Old 03-24-2012
Alternative approach including header you could try:
Code:
awk '{$1=$1}1' infile |
awk '
BEGIN{
  header="Type Of Record|ChargeableDuration|RecordSeqNumber|DateForStartOfCharge|ExIdentity"
  print header
  m=split(header,H,"|")
}
{ 
  $1=$7; $2=$3=$4=$5=x 
  for(i=8;i<=NF;i++) {
    if($i==H[2]) $2=$(i+11)":"$(i+19)":"$(i+27)
    if($i==H[3]) $3=$(i+2)
    if($i==H[4]) $4=$(i+8)
    if($i==H[5]) $5=$(i+2)
  }
  NF=m
}1
' RS= OFS=\|


Last edited by Scrutinizer; 03-24-2012 at 07:22 AM..
This User Gave Thanks to Scrutinizer For This Post:
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Delete blocks with no data..

Hi, I tried this but could not get it... here is what I need I have an xml where I get all the data in blocks but some times I get empty blocks with no data...shown below..I need to delete only those blocks with no data, I tried couple of ways but could not do it..any help is appreciated...... (1 Reply)
Discussion started by: mgirinath
1 Replies

2. Shell Programming and Scripting

How to read text in blocks

Hi, I have file which contains information written in blocks (every block is different). Is it possible to read every block one by one to another file (one block per file). The input is something like this <block1> <empty line> <block2> <empty line> ... ... ... <block25> <empty... (0 Replies)
Discussion started by: art84_)LV
0 Replies

3. Shell Programming and Scripting

Removing blocks from a file

I have a file like the one below. Each record is separated with > In between I have lines consisting of 3 numeric values separated by a space. I need to take each block between the > sign and read the first number in the line. Then take the first after the > sign and the last before the >... (7 Replies)
Discussion started by: kristinu
7 Replies

4. Shell Programming and Scripting

Help with Script using Command Blocks

Hello, I am trying to create a shell script that use command block (donīt really know if this is the correct way to say it), but while one version works fine, the other one is not working at all. So let me show an example of this "command block" Iīm using and its working ok: cat << _EOF_ `echo... (7 Replies)
Discussion started by: Alexis Duarte
7 Replies

5. UNIX for Dummies Questions & Answers

Convert 512-blocks to 4k blocks

I'm Unix. I'm looking at "df" on Unix now and below is an example. It's lists the filesystems out in 512-blocks, I need this in 4k blocks. Is there a way to do this in Unix or do I manually convert and how? So for container 1 there is 7,340,032 in size in 512-blocks. What would the 4k block be... (2 Replies)
Discussion started by: rockycj
2 Replies

6. Shell Programming and Scripting

how to split this file into blocks and then send these blocks as input to the tool called Yices?

Hello, I have a file like this: FILE.TXT: (define argc :: int) (assert ( > argc 1)) (assert ( = argc 1)) <check> # (define c :: float) (assert ( > c 0)) (assert ( = c 0)) <check> # now, i want to separate each block('#' is the delimeter), make them separate files, and then send them as... (5 Replies)
Discussion started by: paramad
5 Replies

7. Shell Programming and Scripting

Transpose lines from individual blocks to unique lines

Hello to all, happy new year 2013! May somebody could help me, is about a very similar problem to the problem I've posted here where the member rdrtx1 and bipinajith helped me a lot. https://www.unix.com/shell-programming-scripting/211147-map-values-blocks-single-line-2.html It is very... (3 Replies)
Discussion started by: Ophiuchus
3 Replies

8. Shell Programming and Scripting

Row blocks to column blocks

Hello, Searched for a while and found some "line-to-column" script. My case is similar but with multiple fields each row: S02 Length Per S02 7043 3.864 S02 54477 29.89 S02 104841 57.52 S03 Length Per S03 1150 0.835 S03 1321 0.96 S03 ... (9 Replies)
Discussion started by: yifangt
9 Replies

9. Shell Programming and Scripting

Blocks into table

please help, I have a huge file with blocks of data which I need to convert to a tabular format. Input sample id: GO:0000017 name: alpha-glucoside transport namespace: biological_process def: "The directed movement of alpha-glucosides into, out of or within a cell, or between... (3 Replies)
Discussion started by: ritakadm
3 Replies
Dt/Help.h(file formats) 												   Dt/Help.h(file formats)

NAME
Dt/Help.h -- help services definitions SYNOPSIS
#include <Dt/Help.h> DESCRIPTION
The Dt/Help.h header defines the variables and function prototypes for help services. The header defines the following DtHelpDialogCallbackStruct windowHint constants: DtHELP_POPUP_WINDOW DtHELP_CURRENT_WINDOW DtHELP_NEW_WINDOW The header defines the following DtHelpDialogCallbackStruct hyperType constants: DtHELP_LINK_JUMP_NEW DtHELP_LINK_TOPIC DtHELP_LINK_MAN_PAGE DtHELP_LINK_APP_DEFINE DtHELP_LINK_TEXT_FILE The header defines the following DtHelpDialogCallbackStruct reason constants: DtCR_HELP_LINK_ACTIVATE DtCR_HELP_CLOSE DtCR_HELP_HELP The header defines the following DtNScrollBarPolicy constants: DtHELP_NO_SCROLLBARS DtHELP_STATIC_SCROLLBARS DtHELP_AS_NEEDED_SCROLLBARS The header defines the following DtNhelpType constants: DtHELP_TYPE_TOPIC DtHELP_TYPE_STRING DtHELP_TYPE_MAN_PAGE DtHELP_TYPE_FILE DtHELP_TYPE_DYNAMIC_STRING The header defines the following DtNpaperSize constants: DtHELP_PAPERSIZE_LETTER DtHELP_PAPERSIZE_LEGAL DtHELP_PAPERSIZE_EXECUTIVE DtHELP_PAPERSIZE_A4 DtHELP_PAPERSIZE_B5 The header defines the following DtHelpQuickDialogGetChild constants: DtHELP_QUICK_CLOSE_BUTTON DtHELP_QUICK_PRINT_BUTTON DtHELP_QUICK_HELP_BUTTON DtHELP_QUICK_SEPARATOR DtHELP_QUICK_MORE_BUTTON DtHELP_QUICK_BACK_BUTTON The header defines the following DtHelpReturnSelectedWidgetId constants: DtHELP_SELECT_ERROR DtHELP_SELECT_VALID DtHELP_SELECT_ABORT DtHELP_SELECT_INVALID The header declares the following as functions: void DtHelpSetCatalogName(char *catFile); int DtHelpReturnSelectedWidgetId(Widget parent, Cursor cursor, Widget *widget); SEE ALSO
Dt/HelpDialog.h - DtHelpDialog(5), Dt/HelpQuickD.h - DtHelpQuickD(5), DtCreateHelpQuickDialog(3), DtCreateHelpDialog(3), DtHelpSetCatalog- Name(3), DtHelpReturnSelectedWidgetId(3), DtHelpDialog(3), DtHelpQuickDialog(3). Dt/Help.h(file formats)
All times are GMT -4. The time now is 08:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy