Unix: cannot add "\\ \n" even with escaping to the end of line
- by HH
I try to convert clean columnwise data to tables in tex. I am unable to have "\ \n" at each end of line. Please, see the command at the end.
Data
$ echo `. ./bin/addTableTexTags.sh < .data_3`
10.31 & 8.50 & 7.40
10.34 & 8.53 & 7.81
8.22 & 8.62 & 7.78
10.16 & 8.53 & 7.44
10.41 & 8.38 & 7.63
10.38 & 8.57 & 8.03
10.13 & 8.66 & 7.41
8.50 & 8.60 & 7.15
10.41 & 8.63 & 7.21
8.53 & 8.53 & 7.12
$ cat .data_3
10.31 8.50 7.40
10.34 8.53 7.81
8.22 8.62 7.78
10.16 8.53 7.44
10.41 8.38 7.63
10.38 8.57 8.03
10.13 8.66 7.41
8.50 8.60 7.15
10.41 8.63 7.21
8.53 8.53 7.12
addTableTexTags.sh
#!/bin/bash
sed -e "s@[[:space:]]@\t\&\t@g" -e "s@[[:space:]]*&*[[:space:]]*\$@\t \\ \\\\n@g"
// Tried Escaping "\\" with "/" here and there
// but cannot get a line ending with "\\ \n".