awk find replace increment

#!/bin/bash awk 'BEGIN { cntr = 0 } /oldStr-123/ { cntr++ ; print "newStr-"cntr } !/oldStr-123/ { print $0 }' oldData.txt > newData.txt

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.