473,387 Members | 1,485 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

converting vertically grouped data to horzontal form in a file

I've a set of data which is grouped vertically and I want that data set in horizontal form. The data is in a file. I think I've to use shell script to do the task.
But I do not have clear idea how to do this task.
###### DATA IN FILE ######
Name: client1
Id: client101
Address: addrs1
Shopping Category: regular
Items in Cart: 2

###### REQUIRED RESULT FORMAT ######
Name Id Address Shopping Category Items in Cart
client1 client101 addrs1 regular 2

How can I do this?
Note: the gap between the characters is 1 tab.
Please also suggest if there is any other way to do this rather than using shell script.

Thank You!!!
May 2 '14 #1
2 2327
Luuk
1,047 Expert 1GB
If the order of the columns is not important, and your inputfile is named 'vertical.txt':
Expand|Select|Wrap|Line Numbers
  1. awk -F ": " '{ h[i]=$1; a[i]=$2; i++ }END{ for (i in h) { printf("%s\t", h[i]); } print; for (i in a) { printf("%s\t", a[i]);}print; }' vertical.txt
  2.  
another way might be Excel or Calc,
- read the file
- select the cells
- paste-special, and use 'transpose'
May 3 '14 #2
Thanks Luuk for the reply.

I'll try this and if there will be any confusion I'll knock again.

Thank You!!!
May 3 '14 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: kee | last post by:
Hi All, I am trying to write binary data to a file, which is bmp image: Open "d:\temp\test001.bmp" For Binary Access Write As #1 Put #1, 1, strImage Close #1 *** strImage contains binary...
4
by: Harald Massa | last post by:
Old, very old informatical problem: I want to "print" grouped data with head information, that is: eingabe= shall give: ( Braces are not important...) 'Stuttgart', '70197' --data--...
4
by: intl04 | last post by:
How do I create a data input form in Access that is external to the Access database to which it's connected (if that's possible, which I believe it is)? For example, if someone clicks on an Access...
1
by: mj | last post by:
I am new to ASP.NET and would like to create a table with grouped data e.g. BOLD TITLE Sales Bill Fred George BOLD TITLE Accounts Alan Carl
3
by: Sharon | last post by:
I have a buffer of byte that contains a raw data of a 1 byte-per-pixel image data. I need to convert this buffer to a Bitmap of Format32bppArgb and to a Bitmap of Format24bppRgb. Can anybody...
1
by: Gino Perruti | last post by:
I am converting an old ASP data entry form to ASP.NET 1.1. The old form has a script block that dynamically adds rows to a table that contain cells with a textbox for quantity, product...
5
by: psbasha | last post by:
Hi, When we read any file data format in any programming language.It will be read as as a string or characters.Later based on the type of data ,we will convert to the respective datatype by type...
2
by: seltzer | last post by:
I am using Access 2000 but I also have the 2003 version. I am working on creating a data entry form in Access for a research study. Since there is a maximum of 255 fields per table in Access, I...
9
by: a | last post by:
Dear friends I want import data from CSV file to mdb file How can I do that in vb.net?
6
by: Shawn | last post by:
Hello: I have the following code in a PHP file. An HTML form passes user comment data to the PHP, which then appends the user comments to the end of the HTML file on which the form is located....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.