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
Solved

Append a pattern at the end of each line

Posted on 2002-06-18
2
271 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
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.

808 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