Search and replace backslash variable combination using sed works with CLI but not script
I'm using Pandoc to convert a LaTeX file of a play to markdown. Pandoc unfortunately does not treat the specialized backslash commands used by the Dramatist package properly, eliminating all of the dialogue.
To get around this problem, I wrote a bash script to pre-process the LaTeX text file. I'm having a peculiar problem with the use of sed to change a backslash-charactername combination to an upper-case version of the charactername. For example, I want this line: \direct{\Benjamin goes to the door and lets \Noah in} to be converted to: \direct{BENJAMIN goes to the door and lets NOAH in} As I am producing a book of twelve plays, there are over a hundred character names all told. My bash script reads the character names from a file and uses variable substitution to change each character name from its backslash proper case version to a non-backslashed upper-case version. When I test the sed line in a CLI environment, it works; when I test it in the script it doesn't. If I type these lines in a CLI environment it works: Code:
Input_File="Test.tex" Code:
Input_File="Test.tex" Here is the contents of the file Test.tex: Code:
\documentclass{article} Peter |
yes, because the problem is not the sed, but the handling of stdin.
I guess you can try something like this: Code:
Input_File="Test.tex" |
You don't need to do the uppercasing with Bash - Sed can do it with \U:
Code:
#!/bin/sh |
All times are GMT -5. The time now is 08:17 AM. |