[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] modifying files in place.
From: |
Pierre Gaston |
Subject: |
Re: [Help-bash] modifying files in place. |
Date: |
Fri, 31 May 2013 05:33:52 +0300 |
On Fri, May 31, 2013 at 4:00 AM, John Kearney <address@hidden> wrote:
> Hi all,
> so I recently came across a new construct (for me) to edit a file in
> place.
> { rm file && awk 'whatever' >file } <file
>
> I'm just wondering how portable is it? This seems to be making use of OS/FS
> specific behavior.
>
> Thanks
>
>
>
It works on all the unix like OS at least and posix defines this behaviour,
The main drawback is that if awk fails you may loose part or all the data.