I\'m having little problem with bash/sed. I need to be able to use command substitution within sed expression. I have two big text files:
first is logfile.t
Just to let people looking for solution with bare shell and sed. Not perfect but working:
cat logfile.txt | while read line ; do id=$(echo -E "$line" |
grep "ERRORID:0x[0-9a-f]*" | grep -o "0x[0-9a-f]*" ) ;
if [ ! -z "$id" ] ; then echo -E "$line" | sed "s/$id/$(grep $id errors.txt |
grep -o '^[A-Z_]*' )/g" ;else echo -E "$line" ; fi ; done
If you see some fixing options then please share.