On Wed, Apr 13, 2016 at 03:28:02PM +0100, Stephane Chazelas wrote:
> 2016-04-13 08:55:16 -0400, Greg Wooledge:
> [...]
> > > And if you want to keep eventual spurious characters after the
> > > last NL character in the file:
> > >
> > > while IFS= read -r line; do printf '%s\n' "$line"; done < tes
2016-04-13 08:55:16 -0400, Greg Wooledge:
[...]
> > And if you want to keep eventual spurious characters after the
> > last NL character in the file:
> >
> > while IFS= read -r line; do printf '%s\n' "$line"; done < test.txt
> > [ -z "$line" ] || printf %s "$line"
>
> Another way to write that is
On Wed, Apr 13, 2016 at 01:43:42PM +0100, Stephane Chazelas wrote:
> 2016-04-13 08:10:15 +0200, Geir Hauge:
> [...]
> > while read -r line; do echo "$line"; done < test.txt
> >
> > though printf should be preferred over echo:
> >
> > while read -r line; do printf '%s\n' "$line"; done < te
2016-04-13 08:10:15 +0200, Geir Hauge:
[...]
> while read -r line; do echo "$line"; done < test.txt
>
> though printf should be preferred over echo:
>
> while read -r line; do printf '%s\n' "$line"; done < test.txt
[...]
Actually, you also need to empty $IFS
while IFS= read -r line; do
On Wed, Apr 13, 2016 at 06:49:51AM -0500, John McKown wrote:
> ???Ah. Thanks. I only use BASH and the GNU infrastructure, so I have never
> run into that problem. I think I'll change my habits, just in case I run
> across a system which doesn't have it (especially in my scripts)
Every implementati
On Wed, Apr 13, 2016 at 6:45 AM, Pierre Gaston
wrote:
>
>
> On Wed, Apr 13, 2016 at 2:34 PM, John McKown > wrote:
>
>> On Wed, Apr 13, 2016 at 1:10 AM, Geir Hauge wrote:
>>
>> ...
>>
>>
>>> though printf should be preferred over echo:
>>>
>>> while read -r line; do printf '%s\n' "$line"; d
On Wed, Apr 13, 2016 at 2:34 PM, John McKown
wrote:
> On Wed, Apr 13, 2016 at 1:10 AM, Geir Hauge wrote:
>
> ...
>
>
>> though printf should be preferred over echo:
>>
>> while read -r line; do printf '%s\n' "$line"; done < test.txt
>>
>
> I've never read about using printf in preference t
On Wed, Apr 13, 2016 at 1:10 AM, Geir Hauge wrote:
...
> though printf should be preferred over echo:
>
> while read -r line; do printf '%s\n' "$line"; done < test.txt
>
I've never read about using printf in preference to echo. Why is that? I
have used it myself in special cases, such a
On Wed, Apr 13, 2016 at 10:01:23AM +0800, 何建军 wrote:
> Hi, I use a very simple statement "cat test.txt | while read line; do echo
> $line; done", test.txt is very small, no more than 100 lines. but the
> execution of the statement paused during process. test.txt is pasted on
> http://paste.bra
Hi, I use a very simple statement "cat test.txt | while read line; do echo
$line; done", test.txt is very small, no more than 100 lines. but the
execution of the statement paused during process. test.txt is pasted on
http://paste.bradleygill.com/index.php?paste_id=1647399
desmond.he@xgimi-dev
10 matches
Mail list logo