📅  最后修改于: 2022-03-11 14:49:28.661000             🧑  作者: Mango
# Operate a substitution in a file, for example changing spaces into tabs
cat myfile.txt | tr " " "\t" > my_new_file.txt
# You can also operate a character substitution
cat myfile.whatever | tr "[a-z]" "[A-Z]" > my_new_file.whatever
# another example, change tabs into new line characters
#(convert tab-separated column into rows)
cat myfile.tsv | tr "\t" "\n" > my_new_file.txt
###---
###---
#I find it particularly useful to change IFS instead of using in-place sed like:
sed -i 's/ /\t/g' myfile.txt
#Best!