9

Different methods to change the delimiter in file content

view full story
linux-howto

http://www.linuxandlife.com – In this article, we will see different methods to change the delimiter in file content, for example: from a comma to a colon. Let's use the following file as example: Linux, 1, A and, 2, B Life, 3, C Debian, 4, D Mint, 5, E Ubuntu, 6, F 1. Use awk awk '$1=$1' FS="," OFS=":" file In this command, FS and OFS are the special variables of awk, which means Input Field separator and Output field separator respectively. FS is assigned to the comma which is the input field separator, OFS is the output field separator which is the colon. $1=$1 actually does nothing here. It e (Distributions)