On Fri, 13 Jan 2012 15:43:03 +0100 Michael Stummvoll <mich...@stummi.org> wrote:
> On 13.01.2012 15:36, Neil Williams wrote: > > $ printenv|grep GDM_LANG|sed -e 's/GDM_LANG=//' > > > > #!/bin/sh > > GLANG=`printenv|grep GDM_LANG|sed -e 's/GDM_LANG=//'` > > echo $GLANG > > > > Why is that hard? > > > did you really read and understand what I wrote in the package > description and the upstream-website? Then the description in the ITP needs to be improved. The point about sed is that sed can substitute whatever you like into whatever you like - printenv with grep and sed gets the value, then another grep for the lines that matter and pass those lines to sed. It really isn't hard. > I want a tool, that reads (e.g from a file) content like > > "foo ${BAR} blup" > > and replaces ${BAR} here with the environment variable BAR As Steve pointed out, then all you need is a little perl or other language loop, not an entirely new package. Maybe it could fit into moreutils but you'd have to convince those maintainers that it is worth the effort. The "problem" being solved is sufficiently trivial, common and varied that any number of people will have already implemented their own solutions without needing to add a dependency on another package. I've probably got four or five slightly different versions hanging around in various scripts and packages already. The advantage of a local perl/python loop is that the entire thing is customised to only look for lines which have 'foo' four characters from the start and not match on 'bar' etc. Some need to skip blank lines, some need to collate lines into paragraphs first ...., some need to handle comments, some don't, some need to understand the content of the file to know what a comment is... Shells can run perl/python snippets as easily as calling anything else. There's no reason to escalate that to a compiled tool. -- Neil Williams ============= http://www.linux.codehelp.co.uk/
pgpbUxBJsb3gS.pgp
Description: PGP signature