Hi All,
I have written a grep command to grep the files containing Windows directories.
I need to output this to a csv.
So here is the code.
OUTPUT_FILE="Sample-format.txt"
ACT_OUTPUT_FILE="Sample-format.csv"
grep -wHrnI --exclude=*.log '[A-Za-z]:[/\]\{1,2\}[A-Za-z]*[/\]\{1,2\}*' .>$OUTPUT_DIR/$OUTPUT_FILE
paste -s -d"\n" $OUTPUT_DIR/$OUTPUT_FILE|tr ":" "|" >>$OUTPUT_DIR/$ACT_OUTPUT_FILE
Now the problem is, when i do
tr ":" "|"
, then the search result which contains windows path like for eg: C:\jfj\ff is getting divided into two columns.
Can anybody please give me some inputs to solve this problem.