[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

RE: Help: How replace comma with a tab in a text file?



On 24-Oct-2000 Jonathan Gift wrote:
> Hi,
> 
> I have a comma delimited ex-database file and I want to replace the commas
> with tabs. I tried using:
> 
> sed s/,/\tab/ filename but no go. It was a guess anyway. I tried replacing
> the tab with a * and it worked, but only for first line of items, mleaving
> the rest of the fields with commas.
> 

you want sed -e 's/,//g'.

sed -e 's/[[:space:]]/,/g'

The [[:space:]] resolves to any whitespace (sorry, getting a tab is a little
harder).  The g on the end means replace this for every occurance, not just the
first.



Reply to: