Professional Web Applications Themes

AWK in 4.X different from 5.X? - FreeBSD

Are the AWK in the 4.X branch and 5.X branch different? Looking at http://www.shelldorado.com/articles/awkcompat.html#os11 it seems the AWK in the 4.X branch has strftime. I have 5.3 in my machine and AWK doesn't have that function....

  1. #1

    Default AWK in 4.X different from 5.X?

    Are the AWK in the 4.X branch and 5.X branch different?
    Looking at
    http://www.shelldorado.com/articles/awkcompat.html#os11

    it seems the AWK in the 4.X branch has strftime.
    I have 5.3 in my machine and AWK doesn't have that function.
    Francisco Guest

  2. #2

    Default Re: AWK in 4.X different from 5.X?

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    On 2005-03-26, Francisco Reyes scribbled these
    curious markings: 

    Probably because the awk on a 4.x machine is GNU awk, whereas the 5.x
    awk is the awk that comes straight from the horse's mouth, so to speak,
    and so thus hasn't been "extended" with GNUisms.

    Best Regards,
    Christopher Nehren
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.0 (FreeBSD)

    iD8DBQFCRaMVk/lo7zvzJioRAnIaAJ9PoqgjruOl1n4xaWupkR8It5yEcQCggK5H
    Kt/c44EQ2hKao69bzpjfqa0=
    =E616
    -----END PGP SIGNATURE-----

    --
    I abhor a system designed for the "user", if that word is a coded
    pejorative meaning "stupid and unsophisticated". -- Ken Thompson
    If you ask the wrong questions, you get answers like "42" and "God".
    Unix is user friendly. However, it isn't idiot friendly.

    Christopher Guest

  3. #3

    Default Re: AWK in 4.X different from 5.X?

    On Sat, 26 Mar 2005, Christopher Nehren wrote:
     

    Thanks.
    That makes sense.
    Now I just wonder how to get date in my output. :-(
    Francisco Guest

  4. #4

    Default Re: AWK in 4.X different from 5.X?

    # Francisco Reyes:

    [ strftime() not in 5.x-awk ] 

    Well, if nothing else helps there's always system("date").
    However, you could also install lang/gawk.

    HTH,
    Mario
    Mario Guest

  5. #5

    Default Re: AWK in 4.X different from 5.X?

    On Sun, 27 Mar 2005, Mario Hoerich wrote:
     
    >
    > Well, if nothing else helps there's always system("date").
    > However, you could also install lang/gawk.[/ref]

    Since this was from a shell script I did
    date | awk '{print "#"$1 " " $2 "-" $3 "-" $6}'

    It works for my needs.
    Francisco Guest

  6. #6

    Default Re: AWK in 4.X different from 5.X?

    On Sun, Mar 27, 2005 at 12:09:03PM -0500, Francisco Reyes wrote: 
    > >
    > >Well, if nothing else helps there's always system("date").
    > >However, you could also install lang/gawk.[/ref]
    >
    > Since this was from a shell script I did
    > date | awk '{print "#"$1 " " $2 "-" $3 "-" $6}'[/ref]

    How about:
    date +"#%a %b - %d - %Y"
    --
    Jonathan Chen <org.nz>
    ----------------------------------------------------------------------
    char *p="char *p=%c%s%c;main(){printf(p,34,p,34);}";main(){print f(p,34,p,34);}
    Jonathan Guest

  7. #7

    Default Re: AWK in 4.X different from 5.X?

    On Mon, Mar 28, 2005 at 10:21:24AM -0500, Francisco Reyes wrote: 
    > >
    > >How about:
    > > date +"#%a %b - %d - %Y"[/ref]
    >
    >
    > Where/how do I put that?
    > I tried to put it inside the awk side, but didn't work.[/ref]

    Eh? The command I was trying to te was:

    date | awk '{print "#"$1 " " $2 "-" $3 "-" $6}'

    which is equivalent to :

    date +"#%a %b - %d - %Y"

    Doing this within awk is another story.. Sorry.
    --
    Jonathan Chen <org.nz>
    ----------------------------------------------------------------------
    Jesus saves.
    Allah forgives.
    Cthulu thinks you'd make a nice sandwich.
    Jonathan Guest

  8. #8

    Default Re: AWK in 4.X different from 5.X?

    On Tue, 29 Mar 2005, Jonathan Chen wrote:
     

    Got it. Originally I thought it was something to do from AWK.
    I tried the string you wrote from the command line and worked.
    I like your approach better. :-)

    Thanks.
    Francisco Guest

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139