Sample Header Ad - 728x90

In a file to find and replace/change multiple strings in a line with shell script

2 votes
2 answers
3013 views
I am new to shell scripting What I have is a log file, each line begins like the below entry,
The desired output to a new file is
2021-04-27 17:03:43 813,ERROR,
2021-04-27 17:04:36 790,SUCCESS,
What I have coded is
while read a; do
    echo ${a//"["/""}
    echo ${a//"]"/""}
done  resultlog.txt
The above code is removing square brackets for alternate lines meaning from the first line "[" opening square is removed and from second line "]" closing bracket is removed I want both to be removed from all the lines. Not only that the dot I want to change to hyphen has shown in the above example.
Asked by Mathewshr (23 rep)
Jun 10, 2021, 11:30 AM
Last activity: Jun 11, 2021, 02:09 AM