1
vote
1answer
129 views

Having trouble piping output of dscl -list to -dscl read using xargs

I'm trying to get every user using dscl and reading each of their records using xargs and dscl. I'm not sure what I'm doing wrong, though, because I would expect this command to take each line of ...
3
votes
2answers
286 views

Why is xargs necessary?

Suppose I want to remove all files in a directory except for one named "notes.txt". I would do this with the pipeline, ls | grep -v "notes.txt" | xargs rm. Why do I need xargs if the output of the ...
1
vote
2answers
642 views

File name with spaces piped to two xargs commands

I have a directory and many more subdirectories like the following - file with spaces.txt filewithsuperlonglines.txt ordinaryfile.txt binaryfile.bin The command - find . -type f -print0 | ...
3
votes
3answers
2k views

How can I grep in source files for some text?

At the moment I'm using two commands, I'm sure there must be a better way... wim@wim-acer:~/ffmpeg$ find . -name "*.h" -print0 | xargs -0 grep -i invalid\ preset wim@wim-acer:~/ffmpeg$ find . -name ...
1
vote
2answers
2k views

How to feed grep output into scp?

I have a file where each line is a file name. Content of the file: file1 file2 file3 ... I then run a grep command to get a subset of the list of the file names. How do I feed the output of the ...
4
votes
3answers
8k views

Why does this not work? “ls *.txt | xargs cat > all.txt” (all files into single txt document)

Why does this not work? ls *.txt | xargs cat > all.txt (I want to join the contents of all text files into a single 'all.txt' file.) find with -exec should also work, but I would really like to ...
1
vote
3answers
2k views

xargs vs backtick

More silly questions from the Linux n00b. =D I'm curious about the performance ramifications of using xargs vs. backticks. For example, what's the different between: find ./ -name foo* | xargs rm ...