Adding a Prefix to Each Line in Bash
Several methods exist to prepend a prefix string to each line of text. The right approach depends on your input source and performance requirements. Using sed The sed stream editor is the most portable and efficient approach: sed ‘s/^/PREFIX/’ file.txt This uses a substitution command where ^ matches the start of each line and PREFIX…
