Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
fuss:awk [2017/02/22 18:30] – external edit 127.0.0.1fuss:awk [2017/12/25 11:33] – [Remove Duplicate Entries in File Without Sorting] office
Line 44: Line 44:
 </code> </code>
  
 +====== Merge Lines by Two in File ======
 +
 +Given a file with the contents:
 +<code>
 +Q: What is this?
 +A: This is a FAQ!
 +</code>
 +
 +and you would like to achieve:
 +<code>
 +Q: What is this? A: This is a FAQ!
 +</code>
 +
 +then the following ''awk'' one liner:
 +<code bash>
 +awk 'NR%2{printf "%s ",$0;next;}1' yourFile
 +</code>
 +
 +will merge all the lines in a file by two.
  

fuss/awk.txt · Last modified: 2022/04/19 08:28 by 127.0.0.1

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.