Replacing Comma by Tab


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Replacing Comma by Tab
# 1  
Old 09-10-2007
Replacing Comma by Tab

Hi All,

i have a file test.txt as shown below,

1,test,test111
2,rest,rest222

i want to replace the commas by tab delimiter..,

it should be like,

1 test test111
2 rest rest222

i tried the following code,

Code:
sed 's/,/\\t/g' test.txt >> ouptut.txt

But, that dint work..,

Could any one help?

Thanks
# 2  
Old 09-10-2007
use double quotes
# 3  
Old 09-10-2007
Hi -

i have used double quotes.., but, it dint work.
# 4  
Old 09-10-2007
sed "s/\,/\\t/g"test.txt >> ouptut.txt
# 5  
Old 09-10-2007
Fazil -

that dint work..,
# 6  
Old 09-10-2007
Hi All -

I have used the below code..,

Code:
sed 's/,/<<press tab>>/g' test.txt > output.txt

And that did the click!!! Thank u all 4 helping Smilie
# 7  
Old 09-10-2007
Code:
tr ',' '\t' < in.txt > out.txt

This User Gave Thanks to vino For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replacing tab value in xml file

Hi I am working on xml file. I have to make sure below lines containing values within quotes are replaced by some character like "-". Below are different lines in xml file. Pattern 1: <Connector port=.... ..... keystoremyPass="xxx" /> Pattern 2: myword="xxxxx" ... (11 Replies)
Discussion started by: krsnadasa
11 Replies

2. Shell Programming and Scripting

Need help with Sed (replacing parenthesis and comma)

I have the following text as an input text: input.txt Results('Toilet', 'Sink', ) and i want to remove the last comma so the output is output.txt Results('Toilet', 'Sink' ) I tried using the following sed command, but I get a parsing error: sed s/, \)/\)/g input.txt >... (5 Replies)
Discussion started by: jl487
5 Replies

3. Shell Programming and Scripting

how to convert comma delimited file to tab separator

Hi all, How can i convert comma delimited .csv file to tab separate using sed command or script. Thanks, Krupa (4 Replies)
Discussion started by: krupasindhu18
4 Replies

4. UNIX for Dummies Questions & Answers

Making a Tab delimiter file to Comma

How can i make a tab delimiter file to a comma delimiter??? (13 Replies)
Discussion started by: saggiboy10
13 Replies

5. UNIX for Dummies Questions & Answers

Replacing | with a comma

I have a huge file which is pipe delimiter and i want to replace the pipe delimiter to a comma Please Help as its v urgent. Ex: parent|child|alias|....Heading of the file...and the data is of similar structure. (4 Replies)
Discussion started by: win4luv
4 Replies

6. Shell Programming and Scripting

sed help - replacing 6th comma with a space

Hi, How can I replace the 6th comma on each line (of a csv) with a space? Any online tutorials with plenty of examples using sed would be very useful. Alex (2 Replies)
Discussion started by: mcclunyboy
2 Replies

7. Shell Programming and Scripting

Suppressing space replacing by comma

hi i want to replace spaces by comma my file is ADD 16428 170 160 3 WNPG 204 941 No 204802 ADD 16428 170 160 3 WNPG 204 941 No 204803 ADD 16428 170 160 3 WNPG 204 941 No 204804 ADD... (9 Replies)
Discussion started by: raghavendra.cse
9 Replies

8. Shell Programming and Scripting

Replacing dot for comma

I wanted to change 34.66 to 34,66. I tried the command: sed 's/./,/' $NUM Where $NUM is a variable with 34.66 value. The output is ,4.66 (2 Replies)
Discussion started by: bdalmeida
2 Replies

9. Shell Programming and Scripting

replace comma(,) with Tab

hi all, i have a file with commas(,). i want to replace all the commas with tab(\t). Plz help...its urgent... (3 Replies)
Discussion started by: vikas_kesarwani
3 Replies

10. Shell Programming and Scripting

replacing comma's with newlines using sed

Hi All, silly question that I'm sure is easy to answer for a more experienced coder... I have a file called test.txt containing the following text... need, to, break, this, line, into, individual, lines using sed, I'd like to make the file look like this... need to break this line... (5 Replies)
Discussion started by: newbie_coder
5 Replies
Login or Register to Ask a Question