You are here
Rik Goldman - Mon, 2010/04/12 - 15:57
Students are working on TKLPatch bundle for Ampache. We're stuck on what we think should be accomplished with sed: We want to insert a line in usage.txt with "Samba: \\$ipaddr\media."
I'm using two reference books and not finding a solution that works.
I'm pretty sure we start sed -i - I then need a regular expression to direct it to a line number maybe?
sed -i '3 /Samba:....' \a usage.txt
Is the closest I can get, and it seems far off. How do I direct it to a blank line? Do I need to escape blank spaces backslashes?
Our original draft had us placing a revised usage.txt in the overlay folder, but I figured a bash manipulation would be the preferred method.
Any feedback would be appreciated...
Forum:
Actually, the preferred method is using the overlay
Thanks for prompt reply.
In that case, it seems we have an Ampache patch ready to be bundled. Students will post a link today.
Looking for the Tips and Tricks Link (and WIKI)
I think when things moved from .. BZR? to Git...
anyway, cant find Alon's link. Working though similar subjects.
(Will Redirect to Git, but can't find anything related to tips or tricks)
http://wiki.turnkeylinux.org/TKLPatch/Usage_tips_and_tricks
thank you for any help
(redirect lands at:)
https://github.com/turnkeylinux/tracker/wiki
Specifically I need to do 2 (1/2) things in a TKLDEV build
1: I want to change the "openerp" database password for postgresql
2: I want to insert that password also into the /opt/openerp/odoo/openerp-server.conf (db_password = password ) that I have created and is using the default password (basically 1 and 2 need to work together)
2 1/2: I also need to change the admin_passwd = "PASS" line in the same file. It is not seemingly set in the database.
Summary:
I have been struggling with the code in
/overlay/usr/lib/inithooks/
Perhaps should ask on tracker but seems a general question.
------------
Truncated.
Separate question re TKLDev and PIP also will be asked.
If you are working with a PostgreSQL DB
As for editing files using sed it is actually pretty easy. Ironically I used to think it was a dark art, but I use it a fair bit now and have the basics downpat. So say you wanted to find "text to find and delete" and wanted to replace it with "new text that replaces it" then you do it like this: "-i' for in place (i.e. edit a file in place) then enclose it in quotes; "s" to substitute; a delimiter (often a slash (/) is used but it can be hard to read sometimes so a pipe (|) is preferable. Then you end up with this:
Often I like to test to make sure it will work how I expect. Do that by echoing the text you want to edit and pipe it to sed (without the -i and the filename). I.e. like this:Add new comment