Is awk able to extract matched grouping as perl?

Gawk has the gensub() function which has the back references you refer to. However, I would suggest using sed for this if you don't want to use something other than perl.

Up vote 0 down vote favorite share g+ share fb share tw.

Echo "file:/home/todd/a. Txt, size:123, md5sum:112sdfddddd, status:success" \ | awk '/file:(. *), size:(.

*),/ { print $1 $2}' Actually, I want to extract "/home/todd/a. Txt" and "123", but the $1 and $2 is not for it. Is there method for extracting matched grouping as perl?

Bash awk link|improve this question asked Mar 23 '11 at 8:56Todd750113 66% accept rate.

Gawk has the gensub() function which has the back references you refer to. However, I would suggest using sed for this if you don't want to use something other than perl awk works best when you think of things in terms of fields. In your case you could use both the colon : and comma , as field separators to strip out your text like so: awk -F':,' '{print $2,$4}' Proof of Concept $ echo "file:/home/todd/a.

Txt, size:123, md5sum:112sdfddddd, status:success" | awk -F':,' '{print $2,$4}' /home/todd/a. Txt 123.

Actually, I need to match several different patterns, and act differently, so I choose awk. – Todd Mar 23 '11 at 9:02 @Todd see my suggestion on using fields – SiegeX Mar 23 '11 at 9:07 nice! I found if I use -F ':,', awk still consider space ' ' as the separator, how can I avoid this?

I don't want ' ' considered as separator sometimes. – Todd Mar 23 '11 at 9:58 @Todd: I don't believe that is the case. I think what you are seeing is an empty field.

Can you give an example line where this behavior happens? – SiegeX Mar 23 '11 at 10:21.

You can use gensub in gawk for backreferences support, however, generally, you can just do this echo "file:/home/todd/a. Txt, size:123, md5sum:112sdfddddd, status:success" | awk -F"," '{ for(i=1;i.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions