Hi, I want to read a file from the command line and remove all the spaces, tabs in it, replacing it with comma(,), and write it to a new file. can you help me out with this scenario.

Recommended Answers

All 4 Replies

Hi sudhanshu!

This should be relatively simple with a search/replace in sed. What have you tried so far?

Using sed you can look for spaces and tabs [ \t] (extended regular expressions will allow modifiers to that). Then you can replace with a comma.
The general format of the sed search/pattern/replace is: s/PATTERN/REPLACEMENT/g I added the g on the end as it is a modifier to include all matches on a line, not just the first (something I think you want).

no every thing said is wrong please go ahed and let me know if you want any further information from me as senior scripting language progaramer

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.