You're viewing a comment by Peter Krumins and its responses.

March 29, 2015, 02:23

There's not much to explain. I simply use nawk twice. The second time I use it I split on \ and print the second field $2, which is the name

cat PP | nawk -F'[\:]' '{print $1}' | nawk -F\\ '{print $2}'

Comment Responses

Karn Kumar Permalink
March 29, 2015, 16:16

Thanks Indeed Peter. I am just confusing as being a learner to the nawk caveats ... So, I was thinking that -F'[\:]' will altogether split ":" & "\" at the same time So, we can avoid using nawk twice..

Thanks Indeed.


March 31, 2015, 06:26

In that case you'd want to use four backslashes \\\\:

Like this:

cat PP | nawk -F'[\\\\:]' '{print $2}'

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "floppy_104": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.