Answer the question
In order to leave comments, you need to log in
Linux Number a file?
There is a file, always with different number of lines.
You need to number it in order, so that it would be like this
text string num=1
text string num=2
text string num=3
etc ..
Or somehow else through the variable
text string num=$num
text string num=$num
text string num= $num
Our bash script generates files with different number of lines, we also need to number it
Answer the question
In order to leave comments, you need to log in
I=$(($I+1)); echo $I
those. full command if not using sed or awwk
I=0; while read LINE; do I=$(($I+1)); echo "$LINE num=$I" >> newfile; done < file
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question