I have a text file with lines saying:
File fileA and fileB differ
File fileX and fileY differ
I need a bash script that goes through the whole file, for each line parses the file names and executes the command diff fileA fileB > fileA.diff
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The following command:
will give you a script you can run to do this.
See the following transcript:
Capture the output, then run it with
bashand you’ll have what you need.Note that this won’t work well with filenames that have spaces in them – if you have such heinous beasts, you will need to do a little more intelligent parsing.