0

Instead of printing out this,

============ Normal grep location of the files ============
ems_inet1/SystemOut1.log
ems_rpt1/SystemOut_19.09.09_23.00.00.log
ems_rpt1/SystemOut_19.09.11_23.00.00.log
============ Compress grep location of the files ============
ems_rpt1/SystemOut_19.05.12_23.00.00.log.gz

I want to print out this instead,

============ Normal grep location of the files ============
ems_inet1 - SystemOut1.log
ems_rpt1 - SystemOut_19.09.09_23.00.00.log
ems_rpt1 - SystemOut_19.09.11_23.00.00.log
============ Compress grep location of the files ============
ems_rpt1 - SystemOut_19.05.12_23.00.00.log.gz

I does not want to have a slash and i want to separate it by a " - " dash

here is the my code

echo "============ Normal grep location of the files ============"
grep -Erl "${input}" ems*/SystemOut*.log
#
echo "============ Compress grep location of the files ============"
zgrep -Erl "${input}" ems*/SystemOut*.log.gz

1 Answer 1

2
grep -Erl "${input}" ems*/SystemOut*.log | sed 's#/# - #'

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.