Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6099317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:15:35+00:00 2026-05-23T13:15:35+00:00

I have this script #!/bin/bash function labels2 () { awk ‘ /[0-9]/{ print substr($3,length($3)-11),

  • 0

I have this script

#!/bin/bash
function labels2 () {
    awk '
    /[0-9]/{
    print substr($3,length($3)-11), $3
    }' $@ | /bin/sort -u  | awk '{print "BUILD: " NR, $2}'
}

function labels () {
    awk '
    /[0-9]/{
    BL[$3] = substr($3,length($3)-11)
    }
    END {
    asort(BL)
    for (i in BL) {
        print i, BL[i]
    }
    }' $@
}


labels $@
exit 0

for a in $@
do
    labels $@ | gawk '
    /BUILD:/ {
    BUILD[$2] = $3
    BUILDCNT ++
    next
    }
    /[0-9]/ {
    DATEd[$3] = $1
    TIMEd[$3] = $2
    MODULESd[$3] = $4
    CASESd[$3] = $5
    FAILEDd[$3] = $6
    COVERd[$3] = $7
    LOCd[$3] = $8
    }
    END {
    SUBSYSTEM=substr(FILENAME, 1, length(FILENAME)-7)
    LABEL= "\"" toupper(SUBSYSTEM) "\""
    print "{"
        print "subsystem: " LABEL ","
        print "    date: {"
        print "        label: " LABEL ","
        print "        data: ["
        for (i = 0 ; i <= BUILDCNT; i ++ ) {
            B=BUILD[i]
            if (DATEd[B]) { print "            [" i ", \"" DATEd[B] "\"]," }
        }
        print "        ]"
        print "    },"
    }
    ' - $a
done

And this text input file cos.txt

2011-01-22 22:12 P16A22_110114072915 22 1312 75 13.55 1399
2011-01-22 22:12 P16A22_110114072915 22 1312 75 13.55 1399

now to my question, why is it printing out

1 110114072915
2 110114072915

instead of

{ 
subsystem: "COS",
  date: {
        label: "CAS",
        data: [[1,"110114072915"],[2,110114072915]]
}

EDIT——————————————————————————–

I did as you guys said, and it partly worked. But now it comes on the form

1 110114072915
2 110114072965{
subsystem: "COS",
    date: {
        label: "COS",
        data: [
            [0, "3"],
        ]
    },

And not on the form

{ 
subsystem: "COS",
  date: {
        label: "CAS",
        data: [[1,"110114072915"],[2,110114072915]]
}

How can I change this? Also I want to do so that they come in order

in the array =)

Thanks yet again for your help =)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:15:36+00:00Added an answer on May 23, 2026 at 1:15 pm

    because of

    labels $@
    exit 0      <-- you told exit after the function "labels"... ;)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a script that looks like this #!/bin/bash function something() { echo hello
If I have a Bash script like: #!/bin/bash f() { # echo function name,
I have a bash script file which starts with a function definition, like this:
For example, i have this simple bash script: #!/bin/sh cd $1; And this cocoa
I have this line in a useful Bash script that I haven't managed to
I have an init.d script that looks like: #!/bin/bash # chkconfig 345 85 60
He all, i have a problem with my bash script. That's my code: #!/bin/bash
Cron installation is vixie-cron /etc/cron.daily/rmspam.cron #!/bin/bash /usr/bin/rm /home/user/Maildir/.SPAM/cur/*; I Have this simple bash script
I have this script: select name,create_date,modify_date from sys.procedures order by modify_date desc I can
Well basically I have this script that takes a long time to execute and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.