Mailinglist Archive: opensuse (2488 mails)

< Previous Next >
Re: [opensuse] Bash script help needed
  • From: Randall R Schulz <rschulz@xxxxxxxxx>
  • Date: Mon, 5 Feb 2007 10:21:12 -0800
  • Message-id: <200702051021.12836.rschulz@xxxxxxxxx>
Jan,

On Monday 05 February 2007 10:15, Jan Karjalainen wrote:
> How do I go through a text file and add ",on" at the end of each
> line?

Sed is the tool you want to use.

sed -e 's/$/,on/' textFile >textFileWithOn


If you have several target files, do this:

for targetFile in textFile1 textFile2; do
sed -e 's/$/,on/' "$targetFile" >"${targetFile}WithOn"
done


If you want to effect an in-place change, you'll have to manipulate the
input and / or output files separately.


> /J


Randall Schulz
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >
References