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

c++ - list<myClass<int> * > sort -

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

java - why am i getting a "cannot resolve method" error on getApplication? -