Perhaps easiest to explain with an example:
$ echo '\&|'
\&|
$ echo '\&|' | while read in; do echo "$in"; done
&|
It seems that the "read" command is interpreting the slashes in the input as escapes and is removing them. I need to process a file line by line without changing its contents and I'm not sure how to stop read from being smart here. Any ideas?
Use
read -r
, as per http://www.ss64.com/bash/read.html:Accrding to: http://www.vias.org/linux-knowhow/bbg_sect_08_02_01.html :
It works on my machine.