Replace spaces with commas from one file and send the output to another file.
tr -s '[:blank:]' ', ' < input.txt > output.txt |
It’s perfect for creating a comma delimited file for importing to Excel.
cloud engineer
Replace spaces with commas from one file and send the output to another file.
tr -s '[:blank:]' ', ' < input.txt > output.txt |
tr -s '[:blank:]' ', ' < input.txt > output.txt
It’s perfect for creating a comma delimited file for importing to Excel.
How to do search and replace in Vim.
Search for “foo” and replace it with “bar” in the current line. Use :s
:s/foo/bar/g |
:s/foo/bar/g
Search for “foo” and replace it with “bar” in the entire document. Use :%s
:%s/foo/bar/g |
:%s/foo/bar/g
You can also pipe instead of forward slash. Useful if your search contains a /.
:%s|foo/|bar|g |
:%s|foo/|bar|g
Here’s how to modify a line in a file using sed.
sed -i 's/replace me.*/with this text/' /path/to/a/file.txt |
sed -i 's/replace me.*/with this text/' /path/to/a/file.txt