For Programmers: Free Programming Magazines  


Home > Archive > AWK > November 2005 > Perl









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Perl
Bitochon

2005-11-17, 6:55 pm

Does anyone know how to append at the end of every line in a perl file.
I have a file that has 3 fields as Field1 Field2 Field3 they are
separate by a space. I need to append " field4" at the end of each
line. I also require that the dat of the file doesn't change.

Dave
<a href="http://www.bitochon.com">http://www.bitochon.com</a>

Minh

2005-11-17, 6:55 pm

Is this work for you ?
sed '/^./s/$/ Field4/ perl-file

Or

awk '$0 !~ /^$/ {print $0,"Field"}' perl-file


Bitochon wrote:
> Does anyone know how to append at the end of every line in a perl file.
> I have a file that has 3 fields as Field1 Field2 Field3 they are
> separate by a space. I need to append " field4" at the end of each
> line. I also require that the dat of the file doesn't change.
>
> Dave
> <a href="http://www.bitochon.com">http://www.bitochon.com</a>


Bitochon

2005-11-18, 9:55 pm

I am using active perl and those commands don't seem to exist?

Michael Heiming

2005-11-18, 9:55 pm

In comp.lang.awk Bitochon <info@bitochon.com>:
> I am using active perl and those commands don't seem to exist?


awk and sed aren't perl commands. Install a real OS and you
should have both available per default.

Good luck

BTW
Please read this before posting anything else:

http://cfaj.freeshell.org/google


--
Michael Heiming (X-PGP-Sig > GPG-Key ID: EDD27B94)
mail: echo zvpunry@urvzvat.qr | perl -pe 'y/a-z/n-za-m/'
#bofh excuse 382: Someone was smoking in the computer room
and set off the halon systems.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com