Gentoo Archives: gentoo-user

From: Alan Mackenzie <acm@×××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] [OT] -print0 but with 'locate'
Date: Sat, 03 Sep 2016 11:15:26
Message-Id: 20160903111440.GA7514@acm.fritz.box
In Reply to: [gentoo-user] [OT] -print0 but with 'locate' by Meino.Cramer@gmx.de
1 Hello, Meino.
2
3 On Sat, Sep 03, 2016 at 11:52:46AM +0200, Meino.Cramer@×××.de wrote:
4 > Hi,
5
6 > I want to 'locate' a bunch of files and feed the output into
7 > '| xargs md5sum'.
8 > Unfortunatexly some of them are infected with the "file name"-virus
9 > (space in the filename).
10 > With find there is the -print0 option which corresponds to '-0' of
11 > the xargs options. As of my knowledge, locate does not have such
12 > a thing.
13 > I dont like the idea to 'find' (read: 'search again')all the files,
14 > which locate already knows...so
15 > Is there any trick/option/whatever to get the files with spaced
16 > filenames processed by md5sum in combination with 'locate'?
17
18 I'm afraid I don't know `locate' at all (it isn't on my system), but
19 does it have something like `ls''s -1 option which prints out each
20 filename on a separate line? In this case you could put quote marks
21 around each file name, for example like this:
22
23 locate .... -1 ..... | sed "s/^.*$/\'&\'/" | xargs md5sum
24
25 > Thank you very much in advance for any help!
26 > Best regards
27 > Meino
28
29 --
30 Alan Mackenzie (Nuremberg, Germany).