1
vote
2answers
135 views

Output of command when piped to another command

I am running a command which does a quick checksum of some file like so find / -type f -ctime +30 -mtime +30 -atime +30 -exec md5sum {} \; | xargs -P 4 and I am trying to run it in parallel with ...
1
vote
3answers
97 views

How to use the pipe command to open a directory after find?

Is there a way to opend found directories (via find) all in one command? One of the things I tried to study several times and never been able to really get, is the effective use of pipe: is it maybe ...
2
votes
3answers
98 views

The processing order and printing of files with find

This simple BASH script collects msgstrs in a PHP project: #!/bin/sh TARGET=/path/to/project LPATH=locale/cy_GB/LC_MESSAGES POFILE=messages.po mkdir -p $LPATH touch $TARGET/$LPATH/$POFILE cd $TARGET ...
3
votes
1answer
412 views

find and rysnc?

I want to be able to search for files over 14 days and over 10k and than rsync those found files to a destination. Is there a way to combine these two commands? find ./ -mtime +14 -size +10k rsync ...
1
vote
3answers
71 views

Variable scope in multiple pipes

I was trying to do something following, find . -name "*.dat" | get the basename of file | move filename returned by first command to basename returned by second command To give a concrete example, ...
7
votes
2answers
8k views

Bash: How to read one line at a time from output of a command?

I am trying to read the output of a command in bash using a while loop. while read -r line do echo "$line" done <<< $(find . -type f) The output I got ranveer@ranveer:~/tmp$ bash ...
4
votes
2answers
403 views

Passing parsed output of sed to find (in this direction)

Well, I think you can find dozens of questions on this platform how to pipe find output to sed, but I haven't found anything for the reverse direction so far. What I want to do is modify my input, and ...
4
votes
3answers
1k views

Why piping find and grep returns nothing?

I'm trying to have grep search inside specified files that are returned by find: find . -type d -name 'mydir*' -exec find '{}' -name '*.java' \; | grep 'MyClass' This doesn't work. Meanwhile, ...
6
votes
3answers
8k views

Pipe find into grep -v

I'm trying to find all files that are of a certain type and do not contain a certain string. I am trying to go about it by piping find to grep -v example: find -type f -name '*.java' | xargs grep -v ...
10
votes
3answers
4k views

Find -exec + vs find | xargs. Which one to choose?

I understand that the -exec can take a + option to mimic the behaviour of xargs. Is there any situation where you'd prefer one form over the other? I personally tend to prefer the first form, if ...
4
votes
2answers
1k views

Using files that have spaces in their name in pipes

I have folder named play which contains a file damn file (with space). When I use find and pipe the output to tar: find play/ -name 'damn*' | tar cf archive.tar -T - It works perfectly. Why does ...
2
votes
4answers
1k views

Open file found with 'find' command

This is probably an easy one, but I can't figure it out and it's pretty much not searchable. In a folder hierarchy I have exactly one file of type xyz. I want to find that file and open it with a ...
20
votes
2answers
9k views

How do I pass a list of files to grep

I am using find and getting a list of files I want to grep through. How do I pipe that list to grep?
4
votes
2answers
638 views

find arcana: can't get pipe to work in -exec line

How do I pipe the results of a find through a sed to xform the stream, and then use that transformed stream as one of two arguments to a script? IE: find turns up file1.tiff (among others) sed ...