For a file that looks like this:
Paul white male 34
Jane black female 22
Sam white male 44
I would like an awk line to treat everything after the first column on the same line as a second column, so that I could run it on the above and produce the following
white male 34
black female 22
white male 44
Currently, awk '{print $2} would only output the first word, not the rest of the line.
THanks!
Answer
One of these should work for you depending what that first space character is and the rest of your spaces are:
awk '{sub(/[^ ]+[ ]+/,"")}1' file
awk -F'\t' '{print $2}' file
No comments:
Post a Comment