How to Print the First Column or Last Column or Both Using `Awk'?

The command for printing the first column or last column of a file can be executed using awk. This is because awk takes input from stdin, which is read by awk. The following program shows how to print the first column and last column of a file.

awk print first characters of a field

By bouguibougui on Jan 15, 2021
awk '{print substr($1,1,1)}'

Add Comment

0

This differs from the print command because only the first or last rows of input are printed out.

Shell/Bash answers related to "awk print first characters of a field"

View All Shell/Bash queries

Shell/Bash queries related to "awk print first characters of a field"

Browse Other Code Languages

CodeProZone