Without trivially saving stdin to a file, can I take the resulting output of stdin, and USE THAT as the pattern to search against a listing in a file?
Try this example: I have a long list.txt of lines containing filenames that I want to know if I currently have in my directory. It's the backwards equivalent of:
ls | grep -F -f list.txt
My attempt goes as follows:
grep -F -f $( ls -1 ) list.txt
But that doesn't work. Is this even possible?
看起来您想使用关键字-
或/dev/stdin
作为原始格式的文件名。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.