Difference between revisions of "Tr"

From wikieduonline
Jump to navigation Jump to search
Tags: Mobile web edit, Mobile edit
Line 4: Line 4:
 
Concatenate [[lines]] on a [[file]]:
 
Concatenate [[lines]] on a [[file]]:
 
  [[cat]] file | tr '\n' ' '
 
  [[cat]] file | tr '\n' ' '
 +
 +
Concatenate/[[merge]] every 2 lines:
 +
<code>cat /path/tofile.txt | [[paste]] -d " "  - -</code><ref>https://stackoverflow.com/a/9605450</ref>
 +
  
 
  [[cat]] file | tr '\n' ''
 
  [[cat]] file | tr '\n' ''

Revision as of 11:10, 30 September 2020

This article is a Draft. Help us to complete it.


Concatenate lines on a file:

cat file | tr '\n' ' '

Concatenate/merge every 2 lines:

cat /path/tofile.txt | paste -d " "  - -[1]


cat file | tr '\n' 
tr: when not truncating set1, string2 must be non-empty

Related commands

See also

  • https://stackoverflow.com/a/9605450
  • Advertising: