0

I am creating an Excel file through shell script. The data should be in 4 columns, but the output data came in one column.

1
  • Post some code. you should mention in your script which column in excel sheet will hold what data Commented Jul 19, 2011 at 14:05

2 Answers 2

1

Create a comma-separated values file. Perhaps, depending on your delimiters:

some process creates colon-separated data | while IFS=: read v1 v2 v3 v4; do
    printf "\"%s\",\"%s\",\"%s\",\"%s\"\n" \
        "$(sed 's/"/""/g' <<< "$v1")" \
        "$(sed 's/"/""/g' <<< "$v2")" \
        "$(sed 's/"/""/g' <<< "$v3")" \
        "$(sed 's/"/""/g' <<< "$v4")" \
    >> my_data.csv
done
Sign up to request clarification or add additional context in comments.

Comments

0

Try adding new line at the end of each statement.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.