On 08/25/2015 11:21 AM, Alice Wonder wrote:
cat file.txt |\
sed -e s?"foo"?"bar"?g |\
sed -e s?"dirty"?"clean?" |\
> file2.txt
I don't understand why you'd quote that way. Though unlikely, you could
potentially match a filename in the working directory, and hose the sed
command.
On 08/25/2015 11:02 AM, Gordon Messmer wrote:
Additionally, you can avoid using "cat" to make the script more
efficient. You'll start fewer processes, and complete more quickly. cat
is almost never needed unless you actually need to con"cat"enate
multiple files.
I sometimes like to use cat
On 08/25/2015 10:50 AM, Jerry Geis wrote:
cat my_file.txt | sed 's/CANCELID/$CHANGE/' > cancel.txt
sed doesn't perform environment variable expansion. That is to say that
when you instruct sed to substitute "$CHANGE" for "CANCELID", "$CHANGE"
is a literal string that will be substituted.
b
On 8/25/2015 10:50 AM, Jerry Geis wrote:
--- This is the two line script
CHANGE="1234"
cat my_file.txt | sed 's/CANCELID/$CHANGE/' > cancel.txt
---
and the my_file.txt has:
CANCELID
it gets changed to $CHANGE instead of the actual value 1234 .
I tried
- Original Message -
| I am trying to use sed to change a value in a pipe.
|
| --- This is the two line script
| CHANGE="1234"
|
| cat my_file.txt | sed 's/CANCELID/$CHANGE/' > cancel.txt
| ---
|
| and the my_file.txt has:
| CANCELID
|
| it gets
On Tue, Aug 25, 2015 at 1:50 PM, Jerry Geis wrote:
> I am trying to use sed to change a value in a pipe.
>
> --- This is the two line script
> CHANGE="1234"
>
> cat my_file.txt | sed 's/CANCELID/$CHANGE/' > cancel.txt
> ---
>
> and the my_file.txt has:
> CA
6 matches
Mail list logo