[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Append a pattern at the end of each line

Posted on 2002-06-18
2
Medium Priority
?
276 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 200 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

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…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
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.
Suggested Courses

864 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