Sponsored Content
Top Forums Shell Programming and Scripting Transpose multiple rows (with a mix of space and enter) to a single column Post 302837405 by sara.nowreen on Thursday 25th of July 2013 05:01:00 PM
Old 07-25-2013
Transpose multiple rows (with a mix of space and enter) to a single column

How to change the uploaded weekly file data to the following format?
Code:
New Well_Id,Old Well_Id,District,Thana,Date,Data,R.L,WellType,Lati.,Longi.
BAG001,PT006,BARGUNA,AMTALI,1/2/1978,1.81,2.29,Piezometer,220825,901430
BAG001,PT006,BARGUNA,AMTALI,1/9/1978,1.87,2.29,Piezometer,220825,901430
BAG001,PT006,BARGUNA,AMTALI,1/16/1978,1.98,2.29,Piezometer,220825,901430
BAG001,PT006,BARGUNA,AMTALI,1/23/1978,2.03,2.29,Piezometer,220825,901430
BAG001,PT006,BARGUNA,AMTALI,1/30/1978,2.03,2.29,Piezometer,220825,901430

Input file:
Code:
                      GROUNDWATER CIRCLE-2,EDPCELL,BWDB
                  Depth to Watertable from Measuring Point
                     Measuring Frequency Monday 0600 hrs
               End Year 88.88 Missing Data 99.99 Unit in metre
New Well_Id :  BAG001       Old Well_Id :  PT006      
District    :  BARGUNA            Thana :  AMTALI             
No. of Change  1
Well Type   Date      Village            Lati.   Longi.   R.L    P.H   Depth 
Piezometer  11.12.77  Amtali             220825  901430    2.29  0.46   8.53
Piezometer  30.12.85  Amtali             220825  901430    2.29  0.46  23.47
------------------------------------------------------------------------------
Yr. 1978  St. Date Jan 02
  1.81  1.87  1.98  2.03  2.03  2.11  2.16  2.14  2.16  2.24  2.29  2.39  2.34
  2.24  2.26  2.14  2.21  2.24  2.14  1.88  1.68  1.47  1.42  1.53  1.50  1.20
  1.20  1.17  1.12  1.14  1.14  1.17  1.12  1.14  0.99  1.17  1.42  1.45  1.40
  1.32  1.42  1.45  1.47  1.53  1.50  1.53  1.47  1.53  1.63  1.60 99.99 99.99
 88.88
Yr. 1979  St. Date Jan 01
  1.70  1.73  1.98  1.96  1.98  2.01  2.01  1.93  1.88  1.85  1.85  1.83  1.91
  1.85  1.83  1.81  1.78  1.73  1.68  1.73  1.73  1.63  1.65  1.60  1.68  1.63
  1.60  1.55  1.50  1.58  1.53  1.32  1.22  1.14  1.14  1.22  1.45  1.42  1.45
  1.40  1.42  1.45  1.53  1.58  1.53  1.73  1.63  1.65  1.70  1.75  1.63  1.75
  1.75 88.88


Last edited by Scott; 07-25-2013 at 06:42 PM.. Reason: Please use code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Converting Single Column into Multiple rows

i have single column which is starting with same string(many number of rows) i have to convert each into a single row.how can i do that? laknar std mes 23 55 laknar isd phone no address amount 99 I have to convert above like below. laknar|std|mes|23|55 laknar|isd|phone... (3 Replies)
Discussion started by: laknar
3 Replies

2. Shell Programming and Scripting

Single column into multiple rows

Hi all, I need to convert this file having just one column into two column file current file: a 15 b 21 c 34 d 48 e 10 wanted: a 15 b 21 c 34 (15 Replies)
Discussion started by: prachiagra
15 Replies

3. Shell Programming and Scripting

awk transpose rows to column

Need to transpose in awk rows to column like this: input: A1,6,5,4 3,2,1, A2,8,7,9,10,11,12,13,14 A3,1,2,3,5,7,8,9 A4,9,4,8,1,5,3, output: A1,1 A1,2 A1,4 ... A2,7 A2,8 ... A3,1 A3,2 ... A4,1 A4,3 (5 Replies)
Discussion started by: sdf
5 Replies

4. Shell Programming and Scripting

How to merge multiple rows into single row if first column matches ?

Hi, Can anyone suggest quick way to get desired output? Sample input file content: A 12 9 A -0.3 2.3 B 1.0 -4 C 34 1000 C -111 900 C 99 0.09 Output required: A 12 9 -0.3 2.3 B 1.0 -4 C 34 1000 -111 900 99 0.09 Thanks (3 Replies)
Discussion started by: cbm_000
3 Replies

5. UNIX for Dummies Questions & Answers

[SOLVED] splitting a single column(with spaces) into multiple rows

Hi All, My requisite is to split a single column of phonemes seperated by spaces into multiple rows. my input file is: a dh u th a qn ch A v U r k my o/p should be like: adhu a dh u (3 Replies)
Discussion started by: girlofgenuine
3 Replies

6. Shell Programming and Scripting

Converting Single Column into Multiple rows, but with strings to specific tab column

Dear fellows, I need your help. I'm trying to write a script to convert a single column into multiple rows. But it need to recognize the beginning of the string and set it to its specific Column number. Each Line (loop) begins with digit (RANGE). At this moment it's kind of working, but it... (6 Replies)
Discussion started by: AK47
6 Replies

7. Shell Programming and Scripting

Convert single column into multiple rows

Convert Single column to multiple rows file a.txt contains data like below Server=abc Run=1 Tables=10 Sessions=16 Time=380 Jobs=5 Server=abc Run=2 Tables=15 Sessions=16 Time=400 Jobs=5 Server=abc Run=3 Tables=20 Sessions=16 Time=450 (5 Replies)
Discussion started by: sol_nov
5 Replies

8. Shell Programming and Scripting

Converting Single Column into Multiple rows

Hi .. anyone can you help me ? i need to convert text below into multiple columns interface; GigabitEthernet0/0/0/0 description; TRUNK_PE-D2-JT2-VPN_Gi0/0/0/0_TO_ME4-A-JKT-JT_4/1/1_1G mtu 9212 negotiation auto interface; GigabitEthernet0/0/0/0.11 description; tes encapsulation;... (1 Reply)
Discussion started by: mad3linux
1 Replies

9. Programming

To transpose rows to column in hadoop

Hi, i am having an HDFS file which is comma seperated, i need to transpose from rows to column only the header columns text.csv cnt,name,place 1,hi,nz 2,hello,aus I need cnt, name, place while using below command in hadoop getting the error hadoop fs -fmt -1 text.csv (0 Replies)
Discussion started by: rohit_shinez
0 Replies

10. UNIX for Beginners Questions & Answers

How to transpose pieces of data in a column to multiple rows?

Hello Everyone, I am very new to the world of regular expressions. I am trying to use grep/sed for the following: Input file is something like this and there are multiple such files: abc 1 2 3 4 5 ***END*** abc 6 7 8 9 ***END*** abc 10 (2 Replies)
Discussion started by: shellnewuser
2 Replies
Date::Manip::ConfigFile(3pm)				User Contributed Perl Documentation			      Date::Manip::ConfigFile(3pm)

NAME
Date::Manip::ConfigFile - sample config file DESCRIPTION
Date::Manip is a highly configurable module. Many of the options can be set in a config file. This document includes a sample config file. The config file consists of three sections. The first section is config variables. This is described more fully in the Date::Manip::Config document. The second section is the holiday definition section. The third section is the event definition section. These are both described more fully in the Date::Manip::Holidays document. SAMPLE CONFIG FILE
The sample config file below works for newer versions of Date::Manip. Some of the config variables may change, or be deprecated, and some may not work with earlier versions of Date::Manip, so it is strongly suggested that you check out the documentation for the version of Date::Manip you are using to confirm any of the config variables you want to include. ################################ # CONFIG VARIABLES ################################ # See Date::Manip::Config man page for a description of all # config variables. # To include configuration information from additional # config files: ConfigFile = /path/to/another/config/file ConfigFile = /path/to/another/config/file2 # For handling other languages Language = English DateFormat = US Encoding = # Set the current timezone: SetDate = now,America/New_York # Set the work work WorkWeekBeg = 1 WorkWeekEnd = 5 WorkDay24Hr = 0 WorkDayBeg = 08:00 WorkDayEnd = 17:00 TomorrowFirst = 1 # Misc. variables YYtoYYYY = 89 FirstDay = 1 Jan1Week1 = 0 Printable = 0 DefaultTime = midnight RecurRange = none ################################ # HOLIDAYS ################################ # See the Date::Manip::Holidays man page for a description of # this section. *HOLIDAYS # FEDERAL HOLIDAYS ################## # You can express New Year's Day as the actual day (Jan 1) # or the observed day (Jan 1 or the nearest week day). # You can't include BOTH because once a day is marked as # a holiday, a second definition will treat it the same # as a weekend and choose another day to assign the holiday # to (so there would be two days designated as New Years). # Jan 1 = New Year's Day 1*1:0:1:0:0:0*DWD = New Year's Day (observed) # Two different ways to defined MLK day third Monday in Jan = Martin Luther King Jr.'s Birthday # 1*1:3:1:0:0:0 = Martin Luther King Jr.'s Birthday # Observed by federal employees in Washington D.C. # Jan 20 = Inauguration day third Monday in Feb = Washington's Birthday last Monday in May = Memorial Day 1st Monday in Sep = Labor Day second Monday in Oct = Columbus Day # Jul 4 = Independence Day 1*7:0:4:0:0:0*DWD = Independence Day # 11/11 = Veterans Day 1*11:0:11:0:0:0*DWD = Veteran's Day # To define both Thanksgiving and the day after, use the # following two lines: fourth Thu in Nov = Thanksgiving 1*11:4:4:0:0:0*FD1 = Day after Thanksgiving # Dec 25 = Christmas 1*12:0:25:0:0:0*DWD = Christmas # SAMPLE HOLIDAYS ################## # You can define a one-time-only holiday by specifying # the day and year. 6/2/1999 = A special test holiday for 1999 ################################ # EVENTS ################################ # See the Date::Manip::Holidays man page for a description of # this section. *EVENTS 2000-02-01 = Event01 2000-02-01-12:00:00 = Event02 02-01 = Event03 02-01 12:00:00 = Event04 1*2:0:3:13:00:00 = Event05 2000-02-05 10:00:00 ; 2000-02-05 10:59:59 = Event06 2000-02-05 ; 2000-02-06 = Event07 02-05 ; 02-06 = Event08 2000-02-07 10:00:00 ; 0:0:0:0:3:0:0 = Event09 02-07 10:00:00 ; 0:0:0:0:4:0:0 = Event10 1*2:0:7:10:00:00 ; 0:0:0:0:5:0:0 = Event11 SEE ALSO
Date::Manip - main module documentation LICENSE
This script is free software; you can redistribute it and/or modify it under the same terms as Perl itself. AUTHOR
Sullivan Beck (sbeck@cpan.org) perl v5.14.2 2012-06-02 Date::Manip::ConfigFile(3pm)
All times are GMT -4. The time now is 09:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy