regex one or none -
This is truncated from a tcpdump
I want to start parsing out just the hex parts of the frames. Code:
more 2frames Code:
more 2frames | perl -nle 'print /\s\s(\w{4}\s\w{4}\s\w{4}\s\w{4}\s\w{4}\s\w{4}\s\w{4}\s\w{2,4})\s/' |
Not sure whether this will do you, but how about:
Code:
more 2frames | perl -nle 'if( $_ =~ m/^ 0x....: (.*)$/){print $1}' Cheers, Tink |
Or you could use grep:
Code:
... | grep -o '[0-9a-f]\{4\}\( [0-9a-f]\{2,4\}\)\+' Grep needs a guide and the one above is not really working. A way to solve it is to pipe again on another grep call but that's already bloated. Here's for awk. Code:
... | awk '/[a-f0-9]+x[a-f0-9]+:/ { sub(/.*: +/, ""); print $0; }' |
I guess it depends on what the non-hex recs can contain, but
Code:
grep '0x' t.t Code:
grep ' 0x' t.t |
All times are GMT -5. The time now is 06:25 PM. |