I want to compare two text files for changes line by line. If the files are store locally I know I can do it with

grep -Fxvf file1 file2

I have a problem because file 2 is in Hadoop File System. I can read this file with the command

hadoop fs -cat /filepath/file2

So naturally I want to feed this result to grep. I tried something like

 grep -Fxvf file1 ${hadoop fs -cat /filepath/file2}

but I get

-bash: ${hadoop fs -cat /filepath/file2}: bad substitution

I tried to use xargs also but with no luck. I appreciate any help.


Thanks to @dsstorefile1 I solved it with

grep -Fxvf <(hadoop fs -cat /fielpath/file2 ) file1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.