I'm trying to do something in bash
with sed
that is proving to be extremely difficult.
I have a bash
script that takes as its first argument a date.
The code want to change a line in a text file to include the passed date. Here's the code
#!/bin/bash
cq_fname="%let outputfile="/user/cq_"$1".csv";"
sed "29s/.*/\"$ct_fname\"/" file1.sas > file2.sas
This script fails on the third line, I get something about a garbled command. Does anybody know a clever way to get this to work? How can I get a forward slash in quotes in sed
?
You can use any character in place of the /
, so just pick one that is not in $ct_fname
:
sed "29s|.*|\"$ct_fname\"|" file1.sas > file2.sas