Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I propose this solution:
$ awk -F'|' -v OFS='\t' '$2 ~ /^[0-9]{1,3}$/ { $2 = 1100 +(++c) } { OFS="\t"; print $1,$2 }' file d1000 1000 d1001 1101 d1002 1102 d1003 1103 d1004 d1005
$ awk -F'|' '$2 ~ /^[0-9]{1,3}$/ { $2 = 1100 +(++c) } { OFS="\t"; print $1,$2 }' file d1000 1000 d1001 1101 d1002 1102 d1003 1103 d1004 d1005
$ awk -F'|' -v OFS='\t' '$2 ~ /^[0-9]{1,3}$/ { $2 = 1100 +(++c) } { print $1,$2 }' file d1000 1000 d1001 1101 d1002 1102 d1003 1103 d1004 d1005