Issue
I am trying to do a few things in a single line and this is my attempt:
coolc -P p good.cool | xargs -I {} sh -c "diff <(sed 's/@[0-9]+/@/g' {}) <(sed 's/@[0-9]+/@/g' good.out)"
- I have a file called
good.out
and I want to runsed
on it:sed 's/@[0-9]+/@/g' good.out
- I want to run
coolc -P p good.cool
which prints result to stdout - I want to use the output from (2) in
sed 's/@[0-9]+/@/g' {}
- I want to
diff
(1) and (3)
Is it possible doing all of these without creating a new files and all in a single line?
Solution
Assuming that the original code was wrong to use xargs, and you really want to run diff
only once:
diff <(coolc -P p good.cool | sed 's/@[0-9]+/@/g') \
<(sed 's/@[0-9]+/@/g' good.out)
Answered By - Charles Duffy Answer Checked By - David Goodson (WPSolving Volunteer)