Reputation: 79735
I'm looking for a Unix command that will allow me to search/replace in a file - I need to replace all commas in a certain file with spaces. I need to do this in a script and I'm looking to avoid parsing/reading the file line by line. Is there a simple unix command that will allow me to do this?
Upvotes: 18
Views: 46267
Reputation: 4234
I would suggest awk, in case you also need to expand your command with some conditionals (take a look here)
awk '{gsub(",", " "); print}' file_path > resultfile_path
Upvotes: 0
Reputation: 39773
You can use awk, sed, vi, ex or even Perl, PHP etc ... depends what you are proficient with.
sed example:
sed -i 's/,/ /g' filename_here
Upvotes: 7