[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RFC: dd oflag=trunc to support in place filtering of files
From: |
Pádraig Brady |
Subject: |
RFC: dd oflag=trunc to support in place filtering of files |
Date: |
Thu, 05 Jun 2014 14:27:44 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 |
The thought just occurred to me that this could be useful
to filter large files in place? For example:
grep whatever file.big | dd bs=1M conv=notrunc oflag=trunc
That would assume that grep never outputs more than it reads,
and would issue a final truncate along the lines of:
ftruncate(STDOUT_FILENO, lseek(STDOUT_FILENO, 0, SEEK_CUR));
Useful enough to add?
Pádraig.
- RFC: dd oflag=trunc to support in place filtering of files,
Pádraig Brady <=