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 ...
- 04-26-2009 #1Just 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
- 04-28-2009 #2Just 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.
- 05-03-2009 #3Just Joined!
- Join Date
- Apr 2009
- Posts
- 2
got it
Got it done but thanks VERY much for your response.
gary


Reply With Quote