Solved

Append a pattern at the end of each line

Posted on 2002-06-18
2
272 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.
Suggested Courses

732 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