Timeline for Working with columns - awk and sed
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 26, 2012 at 19:22 | comment | added | bourne | @Peter.O Awesome thank you! I am learning a ton about how sed and awk work from this thread! I will work through both yours and choroba's suggestions so I can understand them better! | |
Jul 26, 2012 at 5:45 | comment | added | Peter.O |
@bourne: Here is another one for you to work out :) ... The $x and $d are just to aviod some of the clutter in the regex; and it caters for any port/switch value. If they are hex digits, just change $d to suit... x='(..)'; d='[0-9]+'; sed -rn "/$d\/g$d/{ s/\S+\s+$x$x\.$x$x\.$x$x\s+($d\/g$d).*/\1:\2:\3:\4:\5:\6 \7/p }" file
|
|
Jul 26, 2012 at 2:26 | vote | accept | bourne | ||
Jul 26, 2012 at 2:26 | |||||
Jul 26, 2012 at 2:21 | comment | added | bourne | Wow this is great.Thank you very much for the response. I had a little bit of a harder time following this one so I think I might use the awk. But I am going to try and figure out how you did it using this sed expression! Thank you again | |
Jul 25, 2012 at 23:03 | history | edited | choroba | CC BY-SA 3.0 |
deleted 23 characters in body
|
Jul 25, 2012 at 22:56 | history | answered | choroba | CC BY-SA 3.0 |