On 06/09/11 14:14, (Ted Harding) wrote:
OOPS! Sorry, I didn't read your query carefully enough and proceeded on the basis that the "cmd" numers were 4-figure. You will need to extract what follows "cmd" as a separate field. The following mix of awk, sed and sort works (the source file is called "temp.txt" here, and I have added a 3-figure "cmd" entry):
I was concerned that it might be messy like that! (The actual files I'm processing are around 100MB in size so messy means very messy.)
I can't see why the -n or -g switches shouldn't be able to apply but I can't make them work!
Thanks for trying though, I'll play with the awk/sed route and see whether I can make that work for me. For my purposes it won't really matter if I just strip the "cmd" and use sort with -nk3, I just didn't think it should be necessary.