Skip to main content
added 311 characters in body
Source Link
steeldriver
  • 83.8k
  • 12
  • 124
  • 175

You're reading lines, but you're not doing anything with what you read. Try:

#!/bin/sh

while read line
do
        printf '%s\n' "$line" | sed 's/<TEST>/FOO/'
done <&0

Also you may want to change the while read line to

while IFS= read -r line || [ -n "$line" ]

to ensure that you are reading everything as cat testfile.txt | sed 's/<TEST>/FOO/' would. See

You're reading lines, but you're not doing anything with what you read. Try:

#!/bin/sh

while read line
do
        printf '%s\n' "$line" | sed 's/<TEST>/FOO/'
done <&0

You're reading lines, but you're not doing anything with what you read. Try:

#!/bin/sh

while read line
do
        printf '%s\n' "$line" | sed 's/<TEST>/FOO/'
done <&0

Also you may want to change the while read line to

while IFS= read -r line || [ -n "$line" ]

to ensure that you are reading everything as cat testfile.txt | sed 's/<TEST>/FOO/' would. See

Source Link
steeldriver
  • 83.8k
  • 12
  • 124
  • 175

You're reading lines, but you're not doing anything with what you read. Try:

#!/bin/sh

while read line
do
        printf '%s\n' "$line" | sed 's/<TEST>/FOO/'
done <&0