jump to navigation

Rearranger Program

Rearranger program

Problem description

The rearranger program re-arranges any file of CSV format as per the user’s specifications. It takes as input a CSV file and three integers row(r), column(c) and value(v) . Based on the inputs it generates another CSV file as output.

Rearranging the data has many benefits such as automating the generation of graphs from the output, ease of understanding the data, discovering new relationships and associations among data elements and the like.

OverView

Input

input file = “sample.csv”

The input file

Output

$cc rearranger.c –o rearranger

  1. Case 1

$ ./rearranger.exe -i “sample.csv” -r 1 -c 6 -v 3 -o “out.csv”

After using Insert->Object->chart option in Calc

  1. Case 2

$./rearranger.exe -i “sample.csv” -r 1 -c 6 -v 4 -o “out.csv”

After using Insert->Object->chart option in Calc

  1. Case 3

$ ./rearranger.exe -i “sample.csv” -r 1 -c 6 -v 5 -o “out.csv”

After using Insert->Object->chart option in Calc

Examples (on cygwin):

Command(s)

$cc rearranger –o rearranger

$ ./rearranger.exe -i “sample.csv” -r 1 -c 6 -v 3 -o “out.csv”

rows=12

Input

innodb mixed 0.219 0.219 0.219 1

innodb mixed 0.422 0.422 0.422 2

innodb mixed 0.344 0.344 0.344 5

innodb mixed 0.5 0.5 0.5 10

innodb mixed 2.031 2.031 2.031 25

innodb mixed 4.109 4.109 4.109 50

myisam mixed 0.015 0.015 0.015 1

myisam mixed 0.016 0.016 0.016 2

myisam mixed 0.031 0.031 0.031 5

myisam mixed 0.109 0.109 0.109 10

myisam mixed 0.266 0.266 0.266 25

myisam mixed 1.547 1.547 1.547 50

Output

1 2 5 10 25 50

innodb 0.219 0.422 0.344 0.5 2.031 4.109

myisam 0.015 0.016 0.031 0.109 0.266 1.547

Input

Input file = “sample.csv”

innodb,mixed,0.219,0.219,0.219,1,0

innodb,mixed,0.422,0.422,0.422,2,0

innodb,mixed,0.344,0.344,0.344,5,0

innodb,mixed,0.5,0.5,0.5,10,0

innodb,mixed,2.031,2.031,2.031,25,0

innodb,mixed,4.109,4.109,4.109,50,0

myisam,mixed,0.015,0.015,0.015,1,0

myisam,mixed,0.016,0.016,0.016,2,0

myisam,mixed,0.031,0.031,0.031,5,0

myisam,mixed,0.109,0.109,0.109,10,0

myisam,mixed,0.266,0.266,0.266,25,0

myisam,mixed,1.547,1.547,1.547,50,0

Output

Output file = “out.csv”

,1,2,5,10,25,50,

innodb,0.219,0.422,0.344,0.5,2.031,4.109,

myisam,0.015,0.016,0.031,0.109,0.266,1.547,

For further details and clarifications, please do contact, we would love to hear from you :

  1. Taufiq Aalam taufiqaalam@gmail.com

  2. Abdullaah Abdul Khadir abdullah.ak2002@gmail.com

Advertisements

Comments»

No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: