473,396 Members | 1,966 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,396 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 2329
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.