bash - Print Record Number with a prefix -
i have shell script creates csv output file below (on separate lines) :
aaa,111 bbb,222 ccc,999
i want have record number first column in above output such as,
dm1,aaa,111 dm2,bbb,222 dm3,ccc,999
how create variable dm
within shell script?
use awk
:
awk '{print "dm" nr "," $0}' input.csv >output.csv
or
... | awk '{print "dm" nr "," $0}' >output.csv
Comments
Post a Comment