How to Replace a Tab With a Comma in Unix
Unix systems include the "sed" command for managing and manipulating text files. Sed works by checking the contents of a file against a set of rules supplied on the command line, and then replacing all instances of the pattern with a different series of text. Comparable to the "Find and Replace" function on Windows systems, sed is more powerful because it allows you to locate and replace non-text characters, such as tab symbols and new lines. You can use sed to replace a file separated by tabs with one separated by commas.
Instructions
-
-
1
Log on to your Unix system, and access the terminal window by clicking "Terminal" from your system's desktop or "Applications" menu.
-
2
Navigate to the directory that contains the file you'd like to modify by typing "cd /path/to/text/file" without quotes. Change "/path/to/text/file" with the path to the directory containing text document you'd like to change.
-
-
3
Type "sed 's/\t/,/g' <filename>" without quotation marks, and press "Enter." Change "<filename>" to the name of your file (for example, "sed '/s/\t/,/g' myfile.txt").
-
1
Tips & Warnings
Your account must have "write" permission to access the file you are attempting to modify.
Every Unix system places this in a different location, so you may need to consult your manual. It is frequently labeled "Terminal" and is likely accessible directly from your desktop.