Sponsored Content
Top Forums Shell Programming and Scripting Script to convert rows to 1 record with delimter Post 302263509 by dancor97 on Monday 1st of December 2008 08:04:32 PM
Old 12-01-2008
Script to convert rows to 1 record with delimter

I have a data file as follows. The 1st line of record starts with "<JOB" and the last line of record ends with "</JOB". There are multiple rows (62 -70) within <JOB and </JOB and it varies. There are multiple records in the file starting with <JOB and ending with </JOB.

Sample data:
<JOB
NAME=JOE DIZA
AGE=52
DOB=110956
AAA=001
BBB=070
</JOB
<JOB
NAME=YEZDI RANG
AGE=53
DOB=110955
AAA=001
DDD=070
</JOB

I want the output to look like this with delimter '|'
<JOB | NAME=JOE DIZA| AGE=52 | DOB=110956 |AAA=001|BBB=070|</JOB
<JOB | NAME=YEZDI RANG| AGE=53 | DOB=110955 |AAA=001|DDD=070|</JOB

Any help will be appreciated.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

shell script required to convert rows to columns

Hi Friends, I have a log file as below siteid = HYD spc = 100 rset = RS_D_M siteid = DEL spc = 200 rset = RS_K_L siteid = DEL2 spc = 210 rset = RS_D_M Now I need a output like column wise as below. siteid SPC rset HYD 100 RS_D_M (2 Replies)
Discussion started by: suresh3566
2 Replies

2. Shell Programming and Scripting

convert columns into rows

hi, Apologies if this has been covered. I have requirement where i have to convert a single column into multiple column. My data will be like this - 2 3 4 5 6 Output required - 2 3 4 5 6 (1 Reply)
Discussion started by: Nishithinfy
1 Replies

3. Shell Programming and Scripting

awk, string as record separator, transposing rows into columns

I'm working on a different stage of a project that someone helped me address elsewhere in these threads. The .docs I'm cycling through look roughly like this: 1 of 26 DOCUMENTS Copyright 2010 The Age Company Limited All Rights Reserved The Age (Melbourne, Australia) November 27, 2010... (9 Replies)
Discussion started by: spindoctor
9 Replies

4. Shell Programming and Scripting

convert rows to columns

hi, i have the file as below: abc def ghi jkl i want the output as abc,def,ghi,jki please reply, Thanks (4 Replies)
Discussion started by: namitai
4 Replies

5. Shell Programming and Scripting

Convert columns to rows in perl script

Hi All I want to have a Perl script which convert columns to rows. The Perl should should read the data from input file. Suppose the input file is 7215484 date to date 173.3 A 1.50 2.23 8.45 10.14 2.00 4.50 2.50 31.32 7216154 month to month (3 Replies)
Discussion started by: parthmittal2007
3 Replies

6. Shell Programming and Scripting

Help on convert rows to colums

Need help to convert the following data Account name: admin Role: admin Description: Administrator Enabled: Yes to Account Name Role Description Enabled admin admin Administrator Yes Perl or AWK? Thanks San (9 Replies)
Discussion started by: sanguy
9 Replies

7. Shell Programming and Scripting

Convert Rows into Column

Hi Experts, I have a requirement to convert rows into columns. For e.g. Input File: Output File should be like Appreciate if you could suggest code snippet(may be awk) for above requirement... Thanks in Advance for your help... (3 Replies)
Discussion started by: sai_2507
3 Replies

8. Shell Programming and Scripting

Shell script to convert rows to columns

Hi I have a file having the values like below ---------------------------- .set A col1=”ABC” col2=34 col3=”DEF” col4=”LMN” col5=25 .set A .set B col1=55 col3=”XYZ” col4=”PQR” col5=66 .set B .set C col2=”NNN” (1 Reply)
Discussion started by: Suneel Mekala
1 Replies

9. UNIX for Beginners Questions & Answers

Shell script to convert rows into cloumns

B010215861628 MA 01020 CARRIER B010215861695 MA 01020 CARRIER B010215861709 MA 01020 CARRIER My output is in the above format I want the output to be: (4 Replies)
Discussion started by: Teegela Prathyu
4 Replies

10. Shell Programming and Scripting

Help with script to convert rows to columns

Hello I have a large database with the following structure: Headword=Gloss1;Gloss2;Gloss3 The Glosses are separated by a ; What I need is to reduce the multiple glosses on each row to columns Headword=Gloss1 Headword=Gloss2 Headword=Gloss3 I had written the following script in awk... (5 Replies)
Discussion started by: gimley
5 Replies
Datebook(3pm)						User Contributed Perl Documentation					     Datebook(3pm)

NAME
Palm::Datebook - Handler for Palm DateBook and Calendar databases. SYNOPSIS
use Palm::Datebook; DESCRIPTION
The Datebook PDB handler is a helper class for the Palm::PDB package. It parses DateBook and Calendar databases. AppInfo block The AppInfo block begins with standard category support. See Palm::StdAppInfo for details. Sort block $pdb->{sort} This is a scalar, the raw data of the sort block. Records $record = $pdb->{records}[N] $record->{day} $record->{month} $record->{year} The day, month and year of the event. The day and month start at 1 (i.e., for January, "$record->{month}" is set to 1). The year is a four- digit number (for dates in 2001, "$record->{year}" is "2001"). For repeating events, these fields specify the first date at which the event occurs. $record->{start_hour} $record->{start_minute} $record->{end_hour} $record->{end_minute} The start and end times of the event. For untimed events, all of these are 0xff. $record->{when_changed} This is defined and true iff the "when info" for the record has changed. I don't know what this means. $record->{alarm}{advance} $record->{alarm}{unit} If the record has an alarm associated with it, the %{$record->{alarm}} hash exists. The "unit" subfield is an integer: 0 for minutes, 1 for hours, 2 for days. The "advance" subfield specifies how many units before the event the alarm should ring. e.g., if "unit" is 1 and "advance" is 5, then the alarm will sound 5 hours before the event. If "advance" is -1, then there is no alarm associated with this event. New records created via "new_Record" have a 10 minute alarm set by default. "undef $record->{alarm}" to remove this alarm before writing. An alarm icon will still show up in the Datebook if the "alarm" field exists, even with "advance" set to -1. %{$record->{repeat}} This exists iff this is a repeating event. $record->{repeat}{type} An integer which specifies the type of repeat: 0 no repeat. 1 a daily event, one that occurs every day. 2 a weekly event, one that occurs every week on the same day(s). An event may occur on several days every week, e.g., every Monday, Wednesday and Friday. For weekly events, the following fields are defined: @{$record->{repeat}{repeat_days}} This is an array of 7 elements; each element is true iff the event occurs on the corresponding day. Element 0 is Sunday, element 1 is Monday, and so forth. $record->{repeat}{start_of_week} Day the week starts on (0 for Sunday, 1 for Monday). This affects the phase of events that repeat every 2nd (or more) Sunday. 3 a "monthly by day" event, e.g., one that occurs on the second Friday of every month. For "monthly by day" events, the following fields are defined: $record->{repeat}{weeknum} The number of the week on which the event occurs. 0 means the first week of the month, 1 means the second week of the month, and so forth. A value of 5 means that the event occurs on the last week of the month. $record->{repeat}{daynum} An integer, the day of the week on which the event occurs. 0 means Sunday, 1 means Monday, and so forth. 4 a "monthly by date" event, e.g., one that occurs on the 12th of every month. 5 a yearly event, e.g., one that occurs every year on December 25th. $record->{repeat}{frequency} Specifies the frequency of the repeat. For instance, if the event is a daily one, and $record->{repeat}{frequency} is 3, then the event occurs every 3 days. $record->{repeat}{unknown} I don't know what this is. $record->{repeat}{end_day} $record->{repeat}{end_month} $record->{repeat}{end_year} The last day, month and year on which the event occurs. @{$record->{exceptions}} $day = $record->{exceptions}[N][0] $month = $record->{exceptions}[N][1] $year = $record->{exceptions}[N][2] If there are any exceptions to a repeating event, e.g. a weekly meeting that was cancelled one time, then the @{$record->{exceptions}} array is defined. Each element in this array is a reference to an anonymous array with three elements: the day, month, and year of the exception. $record->{description} A text string, the description of the event. $record->{location} A text string, the location (if any) of the event (Calendar database only). $record->{note} A text string, the note (if any) attached to the event. %{$record->{timezone}} This exists iff a time zone has been set for the event. $record->{timezone}{name} The time zone name, e.g., "London" or "San Francisco". $record->{timezone}{country} The country the time zone is in. This is an integer defined in Core/System/PalmLocale.h. $record->{timezone}{offset} This gives the offset from UTC, in minutes, of the time zone. $record->{timezone}{dst_adjustment} This gives the additional offset while daylight savings time is in effect. The offset from UTC is $record->{timezone}{offset} + $record->{timezone}{dst_adjustment} (actually only 0 or 60 are used). $record->{timezone}{custom} Should indicate whether this location was created by the user, though this always seems to be true. $record->{timezone}{flags} Reserved flags. $record->{timezone}{start_hour} $record->{timezone}{start_daynum} $record->{timezone}{start_weeknum} $record->{timezone}{start_month} $record->{timezone}{end_hour} $record->{timezone}{end_daynum} $record->{timezone}{end_weeknum} $record->{timezone}{end_month} These define the period during which daylight savings time is in effect if $record->{timezone}{dst_adjustment} is non-zero. daynum specifies the day of week (0=Sunday, 6=Saturday) and weeknum specifies the week of month (0=1st, 3=4th, 4=last), analagously to the "monthly by day" repeating event. e.g., The "London" time zone has DST starting on the last Sunday of March, which is indicated with start_daynum=0 (Sunday), start_weeknum=4 (last week of the month), and start_month=3 (March). METHODS
new $pdb = new Palm::Datebook; $pdb = new Palm::Datebook({app => 'Calendar'}); Create a new PDB, initialized with the various Palm::Datebook fields and an empty record list. Creates a Datebook PDB by default. Specify the app parameter as 'Calendar' to create a Calendar PDB. new_Record $record = $pdb->new_Record; Creates a new Datebook record, with blank values for all of the fields. "new_Record" does not add the new record to $pdb. For that, you want "$pdb->append_Record". SOURCE CONTROL
The source is in Github: http://github.com/briandfoy/p5-Palm/tree/master AUTHOR
Alessandro Zummo, "<a.zummo@towertech.it>" Currently maintained by brian d foy, "<bdfoy@cpan.org>" SEE ALSO
Palm::PDB(3) Palm::StdAppInfo(3) perl v5.10.1 2010-02-23 Datebook(3pm)
All times are GMT -4. The time now is 10:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy