bug-coreutils
[Top][All Lists]
Advanced

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

Re: Feature Request - prepend to file


From: Eric Blake
Subject: Re: Feature Request - prepend to file
Date: Sat, 05 Apr 2008 20:20:26 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080213 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Brock Noland on 4/5/2008 6:47 PM:
| Greetings,
|
| I find myself for whatever reason, wanting to prepend a file (or
| stdin) to a file. Most often when dealing XML that does not have a top
| level tag.
|
| This can be done safely in the shell but requires a lot of work.
| (Maybe there is already a better way?)

What shell commands have you been trying?  I find the following to be
relatively simple to do:

{ echo header; cat file; } > file1 && mv file1 file

|
| If the source for such a command existed, would it be considered for
| inclusion in coretuils?

Probably not - the bar for adding new coreutils is rather high.  Since
this task can already be accomplished portably in shell, what benefit is
there in adding a non-portable command to repeat the task - you can't rely
on the new command's existence if you want to be portable to other
machines.  Finally, what syntax did you have in mind?  It is probably
possible to write a shell script that has that exact same syntax, but uses
existing commands, to achieve the task without needing to add a new coreutil.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkf4M2kACgkQ84KuGfSFAYDOogCfX+Wv2MO/iC8dxdd6HmKUIUsA
sW8An2RIkuGsugojRepTmCDNtYPZXU/U
=iQCV
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]