Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Sep 2017 20:02:44 +0200
From:      Ralf Mardorf <ralf.mardorf@rocketmail.com>
To:        freebsd-questions@freebsd.org
Cc:        Polytropon <freebsd@edvax.de>
Subject:   Re: case command
Message-ID:  <20170917200244.67a5ca30@archlinux.localdomain>
In-Reply-To: <20170917194020.8f6db248.freebsd@edvax.de>
References:  <59BE89E1.3050209@gmail.com> <VI1PR02MB1200B54F7772D37F6BE020F4F6620@VI1PR02MB1200.eurprd02.prod.outlook.com> <20170917155649.e869897ddcc97c3c9d04929c@sohara.org> <VI1PR02MB12002177D7F2E684D387C90AF6620@VI1PR02MB1200.eurprd02.prod.outlook.com> <20170917194020.8f6db248.freebsd@edvax.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 17 Sep 2017 19:40:20 +0200, Polytropon wrote:
>% grep "catfood" < food.txt > mister_kitty.txt

Regarding https://www.freebsd.org/cgi/man.cgi?query=grep&sektion=&n=1
it should work without the "<" the same way it does on Linux [1].

As already pointed out, the inequality signs/angle brackets cause issues
when sudo is required.

[1]
$ ls -hl bar.txt 
-r-------- 1 root root 4 Sep 17 19:49 bar.txt
$ sudo grep "foo" < bar.txt > out-file.txt 
bash: bar.txt: Permission denied
$ sudo grep "foo" bar.txt > out-file.txt 
$ cat out-file.txt 
foo
$ sudo grep "foo" bar.txt | sudo tee out-file-2.txt 
foo
$ ls -hl out-file*txt
-rw-r--r-- 1 root        root        4 Sep 17 20:00 out-file-2.txt
-rw-r--r-- 1 rocketmouse rocketmouse 4 Sep 17 19:58 out-file.txt

.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170917200244.67a5ca30>