Re: sed question??

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06Jun2015 21:53, bruce <badouglas@xxxxxxxxx> wrote:
Evening..

Morning...

As a test, the following is an attempt to replace "text" from a test
file with "text" from an external file.

aa=$(cat www1.txt)

BTW, this can be written:

 aa=$(< www1.txt)

sed -i "s*#\tISSUES/NOTES::*$aa*g" foo.py1

When I check the foo.py1 file, I get "$aa" in the file, instead of the
replacement text.

Are you sure you used the exact command above? If you have used single quote I would have expected such a result, but not with double quotes.

The test is using replacement delimeters for the sed, as the
replacement text has slashes...

I'm fond of ^G for this purpose:-)

thanks for any pointers.

When debugging sed scripts and other fiddly shell commands it is often useful to trace the actual executed command, thus:

 ( set -x; sed -i "s*#\tISSUES/NOTES::*$aa*g" foo.py1 )

which will should the issued sed command, after the shell has done its mangling.

Cheers,
Cameron Simpson <cs@xxxxxxxxxx>
--
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org




[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux