• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 277
  • Last Modified:

Append a pattern at the end of each line

That´s the question. How can I append a pattern at the end of each
line of a file?

TIA
0
iaguirre
Asked:
iaguirre
1 Solution
 
yuzhCommented:
let say you have a file:myfile, and you want to add aa at the end of each line, you do:

cat myfile |  awk '{print $0"aa"}' > myfile.tmp
mv myfile.tmp myfile

0
 
ahoffmannCommented:
(cat myfile)|awk '{print $0"aa"}'>myfile
(cat myfile)|sed -e 's/$/aa'>myfile
# awk will be faster on huge files
0

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now