Solved

Append a pattern at the end of each line

Posted on 2002-06-18
2
268 Views
Last Modified: 2013-12-27
That´s the question. How can I append a pattern at the end of each
line of a file?

TIA
0
Comment
Question by:iaguirre
2 Comments
 
LVL 38

Expert Comment

by:yuzh
ID: 7089258
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
 
LVL 51

Accepted Solution

by:
ahoffmann earned 50 total points
ID: 7090432
(cat myfile)|awk '{print $0"aa"}'>myfile
(cat myfile)|sed -e 's/$/aa'>myfile
# awk will be faster on huge files
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now