Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

23
  • sed 's/\([^"]\)"/\1/g' Commented Oct 14, 2015 at 19:14
  • But here is the problem.. In my row i have numeric columns also..If i go with this, sed 's/"//g' | sed 's/^/"/' |sed 's/$/"/' | sed 's/|/"|"/g' . This will print all column values with double quotes but I just want only string columns to have double quotes. How to write this cat sample.txt | sed 's/"//g' | sed 's/^/"/' |sed 's/$/"/' | sed 's/|/"|"/g' into a text file? Commented Oct 14, 2015 at 19:14
  • To dump it into a text file, just redirect the output cat sample.txt | sed 's/"//g' | sed 's/^/"/' |sed 's/$/"/' | sed 's/|/"|"/g' > output.txt Let me look for a workaround for the numbers. Is there any other piece of information we need to solve this? Commented Oct 14, 2015 at 19:18
  • By the complexity of the problem, I think is better to go for an structured script that makes it happen. Do you agree? Commented Oct 14, 2015 at 19:22
  • 1
    @Karthik: Please stop having this conversation in comments.  You should edit your question to show examples of your data, what commands you've tried, what results they give, and why they aren't what you want. Commented Oct 22, 2015 at 0:45