Find the answer to your Linux question:
Results 1 to 3 of 3
I'm trying to sort this text file into groups based on the SP2; or # can be from 1-8. What I need done is to group all the SP1: groups ...
  1. #1
    Just Joined!
    Join Date
    Apr 2009
    Posts
    2

    I need help with one complex bash command

    I'm trying to sort this text file into groups based on the SP2; or # can be from 1-8. What I need done is to group all the SP1: groups together under one SP1: command and then group all the SP2: commands under one SP2: and so forth till SP8; (if it exists, not all SPx; commands will exist) as you can see in my attached sample file some groups are split into separate groups with the same SP header that is what I need merged in SP1 through SP8 order. Leaving the other unaffected lines intact like the header lines and trailer lines and single lines with PU; in them.

    I have this but it only does it partially.
    awk '{if(l=="SP7;") {a[i++]=l$0} else {print l$0} l=RT}
    END{print RT;for(i in a){print a[i]}}' RS='SP[0-9];' ORS='' penfile

    any help would be appreciated
    Thanks
    Attached Files Attached Files

  2. #2
    Just Joined!
    Join Date
    Apr 2009
    Posts
    90
    Do you have the CLI version of PHP installed, because I could provide you a script in PHP that would do it.

  3. #3
    Just Joined!
    Join Date
    Apr 2009
    Posts
    2

    got it

    Got it done but thanks VERY much for your response.

    gary

Posting Permissions

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