Question: Write an awk script which prints the first column of a comma-delimited file Sample Input A, 1 B, 2 C, 3 Output for above: A
Write an awk script which prints the first column of a comma-delimited file
Sample Input
| A, 1 B, 2 C, 3 |
Output for above:
| A B C |
You will need to:
Take an input file which has two comma-delimited columns and print only the first column.
You will need to understand that awk works with fields, the default field separator is a space. Be sure to change that to a comma. The first column is the first field.
Note that your awk program is ran on each *record* in the file. By default a record is a line of text.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
