I have a text file with 9 fields separated by :
survey:m1111771::rent:travel:::Morning:
How do I pull field 1 and 8 only to a separate file
for example it would look like this,
survey:Morning
I have a text file with 9 fields separated by :
survey:m1111771::rent:travel:::Morning:
How do I pull field 1 and 8 only to a separate file
for example it would look like this,
survey:Morning
One of many ways:
$ awk -F: '{print $1":"$8}' <file>
survey:Morning
and as @cas as pointed out, where OFS is the "Output Field Separator"
$ awk -F: -v OFS=: '{print $1,$8}'
survey:Morning