Skip to main content
replaced http://unix.stackexchange.com/ with https://unix.stackexchange.com/
Source Link

Solutions that I have come across for replacing the contents of an input file with converted output involve using a temp file or the sponge utility.

Stephane Chazelas'sStephane Chazelas's answeranswer here indicates another way involving opening the file in read-write mode as below.

tr ' ' '\t' < file 1<> file

How does this actually work without corrupting the file in question?

Solutions that I have come across for replacing the contents of an input file with converted output involve using a temp file or the sponge utility.

Stephane Chazelas's answer here indicates another way involving opening the file in read-write mode as below.

tr ' ' '\t' < file 1<> file

How does this actually work without corrupting the file in question?

Solutions that I have come across for replacing the contents of an input file with converted output involve using a temp file or the sponge utility.

Stephane Chazelas's answer here indicates another way involving opening the file in read-write mode as below.

tr ' ' '\t' < file 1<> file

How does this actually work without corrupting the file in question?

edited body
Source Link
iruvar
  • 17k
  • 8
  • 51
  • 81

Solutions that I have come across for replacing the contents of an input file with converted output involve using a temp file or the sponge utility.

Stephane Chalezas'sChazelas's answer here indicates another way involving opening the file in read-write mode as below.

tr ' ' '\t' < file 1<> file

How does this actually work without corrupting the file in question?

Solutions that I have come across for replacing the contents of an input file with converted output involve using a temp file or the sponge utility.

Stephane Chalezas's answer here indicates another way involving opening the file in read-write mode as below.

tr ' ' '\t' < file 1<> file

How does this actually work without corrupting the file in question?

Solutions that I have come across for replacing the contents of an input file with converted output involve using a temp file or the sponge utility.

Stephane Chazelas's answer here indicates another way involving opening the file in read-write mode as below.

tr ' ' '\t' < file 1<> file

How does this actually work without corrupting the file in question?

Source Link
iruvar
  • 17k
  • 8
  • 51
  • 81

Overwriting an input file

Solutions that I have come across for replacing the contents of an input file with converted output involve using a temp file or the sponge utility.

Stephane Chalezas's answer here indicates another way involving opening the file in read-write mode as below.

tr ' ' '\t' < file 1<> file

How does this actually work without corrupting the file in question?