Skip to content
Advertisement

I need a linux script to report all error lines from a log file, and export the results of error lines into a .csv file? [closed]

I have log file for checking transactions, and I have error lines, so I need those error lines to be exported to a .csv file? is there any code using linux bash shell script can do this?

Advertisement

Answer

suppose your error lines consists ERROR. then

grep "ERROR" errorfile.txt | tr -s '[:blank:]' ',' >> errorfile.csv

csv conversion is based on blank spaces to each cell.you can replace blank filter with anything

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement