Sponsored Content
Top Forums Shell Programming and Scripting Help with datafile parsing and creating spreadsheet Post 302632357 by yifangt on Monday 30th of April 2012 12:25:54 AM
Old 04-30-2012
RE:

Good! It's clearer than last time, and the situation is simpler than what I thought .For simplicity I changed the description to string. e.g. CS111 = Student 1 + Course1 + variable1 and so on.
Code:
ST1,CS1,CS111,CS112,CS113,CS114,CS115,CS116
ST1,CS2,CS121,CS122,CS123,CS124,CS125,CS126
...
ST4,CS7,CS471,CS472,CS473,CS474,CS475,CS476
ST4,CS8,CS481,CS482,CS483,CS484,CS485,CS486

By copying radoulov's code
Code:
awk -F"," 'END { for (A in _) print A"," _[A] }
{ _[$1] = $1 in _ ? _[$1] FS $0 : $0 }' input.data > tmp.data

Then by acp's code as transpose.awk:
Code:
awk -f transpose.awk tmp.data > output.data

Code:
    ST1    ST2    ST3    ST4    
    ST1    ST2    ST3    ST4    
    CS1    CS1    CS1    CS1    
    CS111    CS211    CS311    CS411    
    CS112    CS212    CS312    CS412    
    ......   
    CS116    CS216    CS316    CS416    
    ST1    ST2    ST3    ST4    
    CS2    CS2    CS2    CS2    
    CS121    CS221    CS321    CS421  
......

Left the headers for each course and student for clarity, which can be removed easily in Excel.
This User Gave Thanks to yifangt For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

replace one section in a datafile

Hi: First, this is not a homework problem. I just need enough of a hint to get this going... My datafile (dataf.in) is made up of 10 sections. Each section begins with & and with && So it looks like this:------------------------------------- &section1 ...etc... && &section2 ...etc...... (4 Replies)
Discussion started by: Paprika
4 Replies

2. Solaris

oracle datafile *dbf

Hi ,,,, I have move an oracle db from old server to a new server ( solaris 5.9 is the operating system ) my problem is that to new server the datafile ( *.dbf ) are in a different path ..... example old : /export/home/data/blobs ........... new /oracle/data/blobs....... how i can... (3 Replies)
Discussion started by: tt155
3 Replies

3. Shell Programming and Scripting

selective positions from a datafile

Hi dear friends, Im writing a shell script which has to select the strings based on the position. but the problem is there is no field seperator. Normally a datafile contains 2000 records (lines) and each line is of size 500 charecters. I want to select the fields from all the lines which... (10 Replies)
Discussion started by: ganapati
10 Replies

4. UNIX for Dummies Questions & Answers

Append filename to datafile

I am working on an shell script which checks for all the file starting with abc*.* and if file found then the filelines need to append the file name in begining can some one help with the filename appending... for i in `ls $filename*.csv` do echo $i --- NEED to append file name befor... (3 Replies)
Discussion started by: Satyagiri
3 Replies

5. Shell Programming and Scripting

Combine a datafile with Master datafile, emergent!

Hi guys, my supervisor has asked me to solve the problem in 7 days, I've taken 3 days to think about it but couldn't figure out any idea. Please give me some thoughts with the following problem, I have index.database that has only index date: 1994 1995 1996 1997 1998 1999 I have... (6 Replies)
Discussion started by: onthetopo
6 Replies

6. UNIX for Advanced & Expert Users

How do we know which processis creating a datafile

Hi, Is there any way we can find out which process is creating a partucular datafile.I know the user and group but i am just curios to know is there any way to find the process. Thanks (7 Replies)
Discussion started by: ukatru
7 Replies

7. Shell Programming and Scripting

sorting the datafile in an order given in second datafile

Hi, I have two files: first input file is having 7-8 columns, and second data file is like I want to arrange my datafile1 in the order given in second data file, by comparing the seconddatafile with the second column of first file and print the entire line....also if any... (2 Replies)
Discussion started by: CAch
2 Replies

8. Shell Programming and Scripting

Parsing with Name value pair and creating a normalized file

I have url string as follows and I need to parse the name value pair into fields /rows event_id date time payload 1329130951 20120214 22.30.40... (1 Reply)
Discussion started by: smee
1 Replies

9. Shell Programming and Scripting

Validating a datafile with the datatypes

I have two input files 1)datafile 2)metadata file. I have a metadata file like: field1datatypeformat1number2string3dateyy-mm-dd I have a data file like: 1234abc12-8-16 xyz234512-9-163456acd14-08-12 In the first row there is no correction as everything is inline with the metadata.... (3 Replies)
Discussion started by: bikky6
3 Replies

10. Shell Programming and Scripting

Parsing a log file and creating a report script

The log file is huge and lot of information, i would like to parse and make a report . below is the log file looks like: REPORT DATE: Mon Aug 10 04:16:17 CDT 2017 SYSTEN VER: v1.3.0.9 TERMINAL TYPE: prod SYSTEM: nb11cu51 UPTIME: 04:16AM up 182 days 57 mins min MODEL, TYPE, and SN:... (8 Replies)
Discussion started by: amir07
8 Replies
claesy.f(3)							      LAPACK							       claesy.f(3)

NAME
claesy.f - SYNOPSIS
Functions/Subroutines subroutine claesy (A, B, C, RT1, RT2, EVSCAL, CS1, SN1) CLAESY Function/Subroutine Documentation subroutine claesy (complexA, complexB, complexC, complexRT1, complexRT2, complexEVSCAL, complexCS1, complexSN1) CLAESY Purpose: CLAESY computes the eigendecomposition of a 2-by-2 symmetric matrix ( ( A, B );( B, C ) ) provided the norm of the matrix of eigenvectors is larger than some threshold value. RT1 is the eigenvalue of larger absolute value, and RT2 of smaller absolute value. If the eigenvectors are computed, then on return ( CS1, SN1 ) is the unit eigenvector for RT1, hence [ CS1 SN1 ] . [ A B ] . [ CS1 -SN1 ] = [ RT1 0 ] [ -SN1 CS1 ] [ B C ] [ SN1 CS1 ] [ 0 RT2 ] Parameters: A A is COMPLEX The ( 1, 1 ) element of input matrix. B B is COMPLEX The ( 1, 2 ) element of input matrix. The ( 2, 1 ) element is also given by B, since the 2-by-2 matrix is symmetric. C C is COMPLEX The ( 2, 2 ) element of input matrix. RT1 RT1 is COMPLEX The eigenvalue of larger modulus. RT2 RT2 is COMPLEX The eigenvalue of smaller modulus. EVSCAL EVSCAL is COMPLEX The complex value by which the eigenvector matrix was scaled to make it orthonormal. If EVSCAL is zero, the eigenvectors were not computed. This means one of two things: the 2-by-2 matrix could not be diagonalized, or the norm of the matrix of eigenvectors before scaling was larger than the threshold value THRESH (set below). CS1 CS1 is COMPLEX SN1 SN1 is COMPLEX If EVSCAL .NE. 0, ( CS1, SN1 ) is the unit right eigenvector for RT1. Author: Univ. of Tennessee Univ. of California Berkeley Univ. of Colorado Denver NAG Ltd. Date: November 2011 Definition at line 116 of file claesy.f. Author Generated automatically by Doxygen for LAPACK from the source code. Version 3.4.1 Sun May 26 2013 claesy.f(3)
All times are GMT -4. The time now is 08:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy