Sponsored Content
Top Forums Programming How to write a new line to the end of the file in Perl? Post 302421548 by usustarr on Friday 14th of May 2010 06:07:01 PM
Old 05-14-2010
u are a god, thanks

---------- Post updated at 04:07 PM ---------- Previous update was at 02:46 PM ----------

so if i want to change,
Code:
io('write','/home/run/test.log',\ $string);

to
Code:
io('write','/home/run/<$name>test.log',\ $string);

how do i do that?
In other words, lets say i have XXXXXtest.log files, such as pretest.log, aftertest.log, badtest.log. so i want to use a string call name, so i can pick which file to write in to depending on the situation. Could you please tell me how to do that?

Last edited by Scott; 05-14-2010 at 07:31 PM.. Reason: Code tags, please...
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

tar: write error unexpected end of file

Hi, I have attempted to backup some database files on my company's Solaris machine about 3 times now. Each time that I attempt the backup, about 6 files are evident on the dat tape when I do read of the media and then I see the dreaded "tar: write error unexpected EOF" message. Each time that I... (2 Replies)
Discussion started by: robyn
2 Replies

2. Shell Programming and Scripting

perl -write values in a file to @array in perl

Hi can anyone suggest me how to write a file containing values,... say 19 20 21 22 .. 40 to an array @array = (19, 20, ... 40) -- Thanks (27 Replies)
Discussion started by: meghana
27 Replies

3. Programming

concatinate all lines from second line to end of line in perl

I have datafile like ~dta.yunm shhshsgggssssjsksjs sggsjshsjsjssss shshshhshshshs i wish to take only first line and all other lines in concatenated form in second line what should I do??? output like ~dta.yunm shhshsgggssssjsksjssggsjshsjsjssssshshshhshshshs please tell me how... (7 Replies)
Discussion started by: sujit_singh
7 Replies

4. Shell Programming and Scripting

How to write a new entry at the beginning of a log file instead of at the end?

Hi Ladies and Gents, Explanation of my question with an example: Let's consider the script: backup_every_hour.sh #!/bin/bash rsync -auv $dir $backup_dir >> backup_every_hour_script.log Each time this script is called there will be a new entry at the end of the file... (1 Reply)
Discussion started by: freddie50
1 Replies

5. Shell Programming and Scripting

Adding tab/new line at the end of each line of a file

Hello Everyone, I need a help from experts of this community regarding one of the issue that I am facing with shell scripting. My requirement is to append char's at the end of each line of a file. The char that will be appended is variable and will be passed through command line. The... (20 Replies)
Discussion started by: Sourav Das
20 Replies

6. Shell Programming and Scripting

[Perl] Write to a file

Hai #!user/bin/perl -------- -------- print("$line.......\n"); ------- ------ I want to write inside $line into a file like run.log How i can pleasw tel me Thanks kiran (4 Replies)
Discussion started by: kiran425
4 Replies

7. Shell Programming and Scripting

With script bash, read file line per line starting at the end

Hello, I'm works on Ubuntu server My goal : I would like to read file line per line, but i want to started at the end of file. Currently, I use instructions : while read line; do COMMAND done < /var/log/apache2/access.log But, the first line, i don't want this. The file is long... (5 Replies)
Discussion started by: Fuziion
5 Replies

8. Shell Programming and Scripting

Printing string from last field of the nth line of file to start (or end) of each line (awk I think)

My file (the output of an experiment) starts off looking like this, _____________________________________________________________ Subjects incorporated to date: 001 Data file started on machine PKSHS260-05CP ********************************************************************** Subject 1,... (9 Replies)
Discussion started by: samonl
9 Replies

9. Shell Programming and Scripting

Perl to extract values and print at end of each line

In the below perl I am trying to extract and print the values AF1=, the GT value, and F or QUAL diveded by 33 (rounded to the nearest whole #). The GT value is at the end after the GT:PL so all the possibilities are read into a hash h, then depending on the value that is in the line the... (1 Reply)
Discussion started by: cmccabe
1 Replies

10. UNIX for Beginners Questions & Answers

File write begin/end, recording time

Hello all, How can I find out the start and end of the writing file in the directory or recording time for writing file? I have a directory where small ~ 1*MB temporary files are written. After the end of the record, they are retrieved and erased. I can only find out that the files are... (4 Replies)
Discussion started by: mrAibo
4 Replies
Perl::Critic::ProfilePrototype(3)			User Contributed Perl Documentation			 Perl::Critic::ProfilePrototype(3)

NAME
Perl::Critic::ProfilePrototype - Generate an initial Perl::Critic profile. DESCRIPTION
This is a helper class that generates a prototype of a Perl::Critic profile (e.g. a .perlcriticrc file. There are no user-serviceable parts here. INTERFACE SUPPORT
This is considered to be a non-public class. Its interface is subject to change without notice. CONSTRUCTOR
"new( -policies => @POLICY_OBJECTS )" Returns a reference to a new "Perl::Critic::ProfilePrototype" object. METHODS
to_string() Returns a string representation of this "ProfilePrototype". See "OVERLOADS" for more information. OVERLOADS
When a Perl::Critic::ProfilePrototype is evaluated in string context, it produces a multi-line summary of the policy name, default themes, and default severity for each Perl::Critic::Policy object that was given to the constructor of this "ProfilePrototype". If the Policy supports an additional parameters, they will also be listed (but commented-out). The format is suitable for use as a .perlcriticrc file. AUTHOR
Jeffrey Ryan Thalhammer <jeff@imaginative-software.com> COPYRIGHT
Copyright (c) 2005-2011 Imaginative Software Systems. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the LICENSE file included with this module. perl v5.16.3 2014-06-09 Perl::Critic::ProfilePrototype(3)
All times are GMT -4. The time now is 05:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy