Sponsored Content
Top Forums Shell Programming and Scripting Is there a awk solution for this?? Post 302173480 by timj123 on Thursday 6th of March 2008 07:26:48 PM
Old 03-06-2008
Is there a awk solution for this??

I am writing a awk script that gathers certain data from certain fields. I needed a awk solution for this, because it will later become a function in the script.

I have the following data that I need output on a single line, but record spans across multilple lines and records are not "together". Example would be tom below, record "tom" below is on 4 different lines, but I only need data from 2 of the lines, I will also need the same info for pat, tim, and tad, or whoever else has a record like the format below.

Code:
2008   fl01   LAC   2589   polk   doal
xx 2008q1 mx
     sect 25698541

     Sales 08 Dept group

        lead1    2008q1
        tom
        pat
        tim
        tad

        lead1  07q4   07q3   07q2   07q1   06q4   06q3   jan
        tom    0      96     0      3312   3624   0      312
        pat    0      17     0      0      30     0      30
        tim    357    03     04     25     3020   3120   20
        tad    1734   0      0      0      5213   5213   0

        lead1  feb    mar    apr    may    jun    jul    aug
        tom    0      96     0      0      0      0      0
        pat    0      17     0      0      0      0      0
        tim    357    23     5      7      8      14     70
        tad    1734   0      0      0      0      0      0

        lead1  sept   oct    nov    dec
        tom    0      0      460    92
        pat    0      0      240    0
        tim    0      21     1800   0
        tad    0      0      672    0

2008   fl01  LAC   2589    polk   doal
yy 2008q1 mx
     sect 2569852

     Sales 08 Dept group

I needed the following output:

Code:
lead1   07q4    07q1    06q4    06q3    sept    oct     nov
tim	357	25	3020	3120	0	21	1800 
tad	1734	0	5213	5213	0	0	672

Is there a awk solution to this??

thanks in advance for this, because I think this is a difficult one.
 

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Awk solution

Hello! Well, I searched and wasn't able to find a specific example of my dilemma, so hopefully someone could assist? Or maybe there was an example but I missed it? I have two files: file1 = order data file file2 = list of 65,000+ order numbers I would like to extract from 'file1' any... (5 Replies)
Discussion started by: rm -r *
5 Replies

2. Shell Programming and Scripting

AWK or SED solution

Hello. I have big file data like this(part of file): .... 18210102021010000110 47401000000 021001 5166891.16 021011 5166891.16 18210602010020000110 47401000000 020701 8995421.00 021001 8995421.00 021011 8995421.00 030801 .08 18210604011020000110 47401000000 020701 9048.00 021001... (3 Replies)
Discussion started by: maxoff
3 Replies

3. Shell Programming and Scripting

Any solution with awk for volatile columns??

Hi I have this file with content ale,4 ,ale,2 ,ale,1 ,ale,2 ale,1 ,ale,7 ,ale,7 ,ale,13 ale,6 ,ale,1 ,ale,1 ,ale,1 ale,1 ,ale,1 ,ale,37 ,ale,1 ale,1 ,ale,1 ,ale,2 ,ale,37 ale,77 ,ale,1 ,ale,53 ,ale,3 ale,5 ,ale,1 ,ale,2 ,ale,40 ale,1 ,ale,1 ,ale,44 ,ale,1... (7 Replies)
Discussion started by: nikhil jain
7 Replies

4. Shell Programming and Scripting

sed or awk Solution

Hi I am having a csv file like this ahsh,90.82,add,32424,ahha hhdh,98.89,hdhdh,92728,neha hshs,you,97.7,hdhdhd,are,a jsjsj,wonderful,9788,79.9,aheh ahdh,95.5,girl, 2737,jolllI need to add width="100" to the value which is greater than 90 like decimal points but less than 100 Output... (5 Replies)
Discussion started by: kshitij
5 Replies

5. UNIX for Dummies Questions & Answers

Help with awk solution to add columns

Hi all. Wondering if someone can help with an awk solution to a problem I'm stumped with. I have a matrix file with >1000 fields and would like to add another column after each column with a text label. For example: Input: $cat file.txt name col1 col2 col3 coln aaaa ... (2 Replies)
Discussion started by: torchij
2 Replies

6. UNIX for Beginners Questions & Answers

awk solution for Splitting a file.

Hi I have a csv file with as below sdg-catalog-00000001 sdg-sku-00000317 sdg-sku-00000318 sdg-sku-00000319 sdg-sku-00000320 sdg-catalog-00000002 sdg-sku-00000321 sdg-sku-00000322 sdg-sku-00000323 sdg-sku-00000324 sdg-sku-00000325 sdg-catalog-00000003 sdg-sku-00000326... (3 Replies)
Discussion started by: Raghuram717
3 Replies
DateTime::Locale::mo(3) 				User Contributed Perl Documentation				   DateTime::Locale::mo(3)

NAME
DateTime::Locale::mo SYNOPSIS
use DateTime; my $dt = DateTime->now( locale => 'mo' ); print $dt->month_name(); DESCRIPTION
This is the DateTime locale package for Moldavian. DATA
This locale inherits from the DateTime::Locale::ro_MD locale. It contains the following data. Days Wide (format) luni marXi miercuri joi vineri sambXtX duminicX Abbreviated (format) Lu Ma Mi Jo Vi Sa Du Narrow (format) L M M J V S D Wide (stand-alone) luni marXi miercuri joi vineri sambXtX duminicX Abbreviated (stand-alone) Lu Ma Mi Jo Vi Sa Du Narrow (stand-alone) L M M J V S D Months Wide (format) ianuarie februarie martie aprilie mai iunie iulie august septembrie octombrie noiembrie decembrie Abbreviated (format) ian. feb. mar. apr. mai iun. iul. aug. sept. oct. nov. dec. Narrow (format) I F M A M I I A S O N D Wide (stand-alone) ianuarie februarie martie aprilie mai iunie iulie august septembrie octombrie noiembrie decembrie Abbreviated (stand-alone) ian. feb. mar. apr. mai iun. iul. aug. sept. oct. nov. dec. Narrow (stand-alone) I F M A M I I A S O N D Quarters Wide (format) trimestrul I trimestrul al II-lea trimestrul al III-lea trimestrul al IV-lea Abbreviated (format) trim. I trim. II trim. III trim. IV Narrow (format) T1 T2 T3 T4 Wide (stand-alone) trimestrul I trimestrul al II-lea trimestrul al III-lea trimestrul al IV-lea Abbreviated (stand-alone) trim. I trim. II trim. III trim. IV Narrow (stand-alone) T1 T2 T3 T4 Eras Wide inainte de Hristos dupX Hristos Abbreviated i.Hr. d.Hr. Narrow i.Hr. d.Hr. Date Formats Full 2008-02-05T18:30:30 = marXi, 5 februarie 2008 1995-12-22T09:05:02 = vineri, 22 decembrie 1995 -0010-09-15T04:44:23 = sambXtX, 15 septembrie -10 Long 2008-02-05T18:30:30 = 5 februarie 2008 1995-12-22T09:05:02 = 22 decembrie 1995 -0010-09-15T04:44:23 = 15 septembrie -10 Medium 2008-02-05T18:30:30 = 05.02.2008 1995-12-22T09:05:02 = 22.12.1995 -0010-09-15T04:44:23 = 15.09.-010 Short 2008-02-05T18:30:30 = 05.02.2008 1995-12-22T09:05:02 = 22.12.1995 -0010-09-15T04:44:23 = 15.09.-010 Default 2008-02-05T18:30:30 = 05.02.2008 1995-12-22T09:05:02 = 22.12.1995 -0010-09-15T04:44:23 = 15.09.-010 Time Formats Full 2008-02-05T18:30:30 = 18:30:30 UTC 1995-12-22T09:05:02 = 09:05:02 UTC -0010-09-15T04:44:23 = 04:44:23 UTC Long 2008-02-05T18:30:30 = 18:30:30 UTC 1995-12-22T09:05:02 = 09:05:02 UTC -0010-09-15T04:44:23 = 04:44:23 UTC Medium 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 09:05:02 -0010-09-15T04:44:23 = 04:44:23 Short 2008-02-05T18:30:30 = 18:30 1995-12-22T09:05:02 = 09:05 -0010-09-15T04:44:23 = 04:44 Default 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 09:05:02 -0010-09-15T04:44:23 = 04:44:23 Datetime Formats Full 2008-02-05T18:30:30 = marXi, 5 februarie 2008, 18:30:30 UTC 1995-12-22T09:05:02 = vineri, 22 decembrie 1995, 09:05:02 UTC -0010-09-15T04:44:23 = sambXtX, 15 septembrie -10, 04:44:23 UTC Long 2008-02-05T18:30:30 = 5 februarie 2008, 18:30:30 UTC 1995-12-22T09:05:02 = 22 decembrie 1995, 09:05:02 UTC -0010-09-15T04:44:23 = 15 septembrie -10, 04:44:23 UTC Medium 2008-02-05T18:30:30 = 05.02.2008, 18:30:30 1995-12-22T09:05:02 = 22.12.1995, 09:05:02 -0010-09-15T04:44:23 = 15.09.-010, 04:44:23 Short 2008-02-05T18:30:30 = 05.02.2008, 18:30 1995-12-22T09:05:02 = 22.12.1995, 09:05 -0010-09-15T04:44:23 = 15.09.-010, 04:44 Default 2008-02-05T18:30:30 = 05.02.2008, 18:30:30 1995-12-22T09:05:02 = 22.12.1995, 09:05:02 -0010-09-15T04:44:23 = 15.09.-010, 04:44:23 Available Formats d (d) 2008-02-05T18:30:30 = 5 1995-12-22T09:05:02 = 22 -0010-09-15T04:44:23 = 15 EEEd (EEE d) 2008-02-05T18:30:30 = Ma 5 1995-12-22T09:05:02 = Vi 22 -0010-09-15T04:44:23 = Sa 15 Hm (H:mm) 2008-02-05T18:30:30 = 18:30 1995-12-22T09:05:02 = 9:05 -0010-09-15T04:44:23 = 4:44 hm (h:mm a) 2008-02-05T18:30:30 = 6:30 PM 1995-12-22T09:05:02 = 9:05 AM -0010-09-15T04:44:23 = 4:44 AM Hms (H:mm:ss) 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 9:05:02 -0010-09-15T04:44:23 = 4:44:23 hms (h:mm:ss a) 2008-02-05T18:30:30 = 6:30:30 PM 1995-12-22T09:05:02 = 9:05:02 AM -0010-09-15T04:44:23 = 4:44:23 AM M (L) 2008-02-05T18:30:30 = 2 1995-12-22T09:05:02 = 12 -0010-09-15T04:44:23 = 9 Md (d.M) 2008-02-05T18:30:30 = 5.2 1995-12-22T09:05:02 = 22.12 -0010-09-15T04:44:23 = 15.9 MEd (E, d MMM) 2008-02-05T18:30:30 = Ma, 5 feb. 1995-12-22T09:05:02 = Vi, 22 dec. -0010-09-15T04:44:23 = Sa, 15 sept. MMdd (dd.MM) 2008-02-05T18:30:30 = 05.02 1995-12-22T09:05:02 = 22.12 -0010-09-15T04:44:23 = 15.09 MMM (LLL) 2008-02-05T18:30:30 = feb. 1995-12-22T09:05:02 = dec. -0010-09-15T04:44:23 = sept. MMMd (d MMM) 2008-02-05T18:30:30 = 5 feb. 1995-12-22T09:05:02 = 22 dec. -0010-09-15T04:44:23 = 15 sept. MMMEd (E, d MMM) 2008-02-05T18:30:30 = Ma, 5 feb. 1995-12-22T09:05:02 = Vi, 22 dec. -0010-09-15T04:44:23 = Sa, 15 sept. MMMEEEd (EEE, d MMM) 2008-02-05T18:30:30 = Ma, 5 feb. 1995-12-22T09:05:02 = Vi, 22 dec. -0010-09-15T04:44:23 = Sa, 15 sept. MMMMd (d MMMM) 2008-02-05T18:30:30 = 5 februarie 1995-12-22T09:05:02 = 22 decembrie -0010-09-15T04:44:23 = 15 septembrie MMMMEd (E, d MMMM) 2008-02-05T18:30:30 = Ma, 5 februarie 1995-12-22T09:05:02 = Vi, 22 decembrie -0010-09-15T04:44:23 = Sa, 15 septembrie ms (mm:ss) 2008-02-05T18:30:30 = 30:30 1995-12-22T09:05:02 = 05:02 -0010-09-15T04:44:23 = 44:23 y (y) 2008-02-05T18:30:30 = 2008 1995-12-22T09:05:02 = 1995 -0010-09-15T04:44:23 = -10 yM (M.yyyy) 2008-02-05T18:30:30 = 2.2008 1995-12-22T09:05:02 = 12.1995 -0010-09-15T04:44:23 = 9.-010 yMEd (EEE, d/M/yyyy) 2008-02-05T18:30:30 = Ma, 5/2/2008 1995-12-22T09:05:02 = Vi, 22/12/1995 -0010-09-15T04:44:23 = Sa, 15/9/-010 yMMM (MMM y) 2008-02-05T18:30:30 = feb. 2008 1995-12-22T09:05:02 = dec. 1995 -0010-09-15T04:44:23 = sept. -10 yMMMEd (EEE, d MMM y) 2008-02-05T18:30:30 = Ma, 5 feb. 2008 1995-12-22T09:05:02 = Vi, 22 dec. 1995 -0010-09-15T04:44:23 = Sa, 15 sept. -10 yMMMM (MMMM y) 2008-02-05T18:30:30 = februarie 2008 1995-12-22T09:05:02 = decembrie 1995 -0010-09-15T04:44:23 = septembrie -10 yQ ('trimestrul' Q y) 2008-02-05T18:30:30 = trimestrul 1 2008 1995-12-22T09:05:02 = trimestrul 4 1995 -0010-09-15T04:44:23 = trimestrul 3 -10 yQQQ (QQQ y) 2008-02-05T18:30:30 = trim. I 2008 1995-12-22T09:05:02 = trim. IV 1995 -0010-09-15T04:44:23 = trim. III -10 yyMM (MM.yy) 2008-02-05T18:30:30 = 02.08 1995-12-22T09:05:02 = 12.95 -0010-09-15T04:44:23 = 09.-10 yyMMM (MMM yy) 2008-02-05T18:30:30 = feb. 08 1995-12-22T09:05:02 = dec. 95 -0010-09-15T04:44:23 = sept. -10 yyQ (Q yy) 2008-02-05T18:30:30 = 1 08 1995-12-22T09:05:02 = 4 95 -0010-09-15T04:44:23 = 3 -10 yyyyMM (MM.yyyy) 2008-02-05T18:30:30 = 02.2008 1995-12-22T09:05:02 = 12.1995 -0010-09-15T04:44:23 = 09.-010 yyyyMMMM (MMMM y) 2008-02-05T18:30:30 = februarie 2008 1995-12-22T09:05:02 = decembrie 1995 -0010-09-15T04:44:23 = septembrie -10 Miscellaneous Prefers 24 hour time? Yes Local first day of the week luni SUPPORT
See DateTime::Locale. AUTHOR
Dave Rolsky <autarch@urth.org> COPYRIGHT
Copyright (c) 2008 David Rolsky. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This module was generated from data provided by the CLDR project, see the LICENSE.cldr in this distribution for details on the CLDR data's license. perl v5.18.2 2017-10-06 DateTime::Locale::mo(3)
All times are GMT -4. The time now is 10:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy