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

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -