have you checked the GNU sed man page recently? it does
in-place-editing with the -i or --in-place switch.

sed -i s/^/./g porndomain.acl

would have worked as well, without the side-effect .bak file being produced.

On Thu, Jul 16, 2009 at 3:17 AM, Richard Paradies<[email protected]> wrote:
> sed  doesn't edit in situ.
>
> Try
>
> $ cat add_dot.txt
> sex.com
> blahblah.com
> weak.com
>
> sed 's/^/./gw u.out'  add_dot.txt | mv u.out add_dot.txt
>
> $ cat add_dot.txt
> .sex.com
> .blahblah.com
> .weak.com
>
>
>
> On Wed, Jul 15, 2009 at 10:28 AM, Kelsey Hartigan Go
> <[email protected]> wrote:
>>
>> You can use ex, or even vi
>> %s/^/\./g
>> :wq
>>
>>
>> On 7/15/09, eric pareja <[email protected]> wrote:
>> > hi david,
>> >
>> > the more "traditional" way would have been to use sed as follows:
>> >
>> > sed -i.bak s/^/./g porndomain.cal
>> >
>> > side-effect is to generate a backup file with the .bak extension.
>> >
>> > xen
>> >
>> > On Wed, Jul 15, 2009 at 12:14 PM, david t. asuncion,
>> > jr.<[email protected]> wrote:
>> >> A total CLI newbie here. :)
>> >>
>> >> I have a file like this...
>> >>
>> >> cat porndomain.acl
>> >>
>> >> sex.com
>> >> blahblah.com
>> >> weak.com
>> >> ....
>> >>
>> >> What I want to happen is to add a "." on each line to look like this...
>> >>
>> >> .sex.com
>> >> .blahblah.com
>> >> .weak.com
>> >>
>> >> How can I do that with one line of command in Linux?
>> >>

-- 
eric pareja ([email protected]) LPIC-2 | PGP/GPG Key 0xB82E42D9
Coordinator for Technology / Senior Linux Trainer
National Telehealth Center, University of the Philippines Manila
International Open Source Network - ASEAN+3
"Ang mundo ay aklat, at iisang pahina lamang ang nababasa ng hindi naglalakbay."
 わかよたれぞ つねならむ
_________________________________________________
Philippine Linux Users' Group (PLUG) Mailing List
http://lists.linux.org.ph/mailman/listinfo/plug
Searchable Archives: http://archives.free.net.ph

Reply via email to