Visit Our UNIX and Linux User Community

I need help to create a file using Perl

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting I need help to create a file using Perl
# 1  
Old 08-26-2009
I need help to create a file using Perl

Hi, i have some files in text format and i want to create a file with all the information in the others files, but i don't want copy all the information exactly i just need the information from the fourth line to the end of file

I will try to explain with an example:





and i want a file like this



I wonder if it is possible to make it using PERL, if somebody can help me i will apreciate Smilie
# 2  
Old 08-27-2009

Try this...

#!/usr/bin/perl -w
while (<*.txt>) {                                 #for each .txt file
   open (FH, "<$_") or die "Can't open file $_";  #  open file handle
   while (<FH>) {                                 #  while not end of file
      if ($. > 4) {                               #    if line number > 4 
         print $_;                                #       print full line incl. end of line char
   close (FH);                                    #  close file handle

Previous Thread | Next Thread
Test Your Knowledge in Computers #1007
Difficulty: Medium
ix = ln(cos x+isin x)
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using perl or awk to create ngrams

Hello, I am interested in writing a context driven NGram analysis i.e. detecting the frequency of utterance of a given character based on its immediate context i.e. the character which can preced and follow the given entity. In the case of Intial and Final the context would be immediate character... (4 Replies)
Discussion started by: gimley
4 Replies

2. Programming

help need in the perl script that create one xml file form multiple files.

Hi every one, Please excuse me if any grammatical mistakes is there. I have multiple xml files in one directory, I need to create multiple XML files into one XML file.example files like this</p> file1:bvr.xml ... (0 Replies)
Discussion started by: veerubiji
0 Replies

3. Programming

perl script to create hash.

Hi, I have the xml file file this, perl script to create hash<p> <university> <name>svu</name> <location>ravru</location> <branch> <electronics> <student name="xxx" number="12"> <semester number="1"subjects="7" rank="2"/> </student> <student name="xxx"... (1 Reply)
Discussion started by: veerubiji
1 Replies

4. Shell Programming and Scripting

How to create hash dynamically in perl?

Hi, I have one file name file.txt It has the following contents: #File Contents StartTime,EndTime,COUNTER1,COUNTER2,COUNTER3 12:13,12:14,0,1,0 The output should be like this: StartTime: 12:13 ENDTIME: 12:14 (2 Replies)
Discussion started by: vanitham
2 Replies

5. Shell Programming and Scripting

How to create a xml file using Perl Script

Hi All, I have some data which needs to be saved in the xml file format.Can you guys please let me know how to do this using perl script. NOTE: the template of the xml file shall be depending on validation of the data done for some requirements. Basically to summarise, the fields in the xml... (5 Replies)
Discussion started by: girish.raos
5 Replies

6. Shell Programming and Scripting

how to create a file in perl

hey gurus! i m a perl newbie!! i want to create an empty file and also directory in perl... how to print a msg if the present working directory has ".db" extension. like in shell if ] ; then echo "hello " i want to do this in perl!! please help.. (4 Replies)
Discussion started by: tprayush
4 Replies

7. Shell Programming and Scripting

Create tab-delimited file of outputs - Perl

Title is very broad, but here's an outline of what I have done so far: - I have multiple subdirectories containing multiple *.fna files of DNA sequences - I've been able to traverse these subdirectories and create a tab-delimited text file (i.e. the association file) that shows the contents of... (1 Reply)
Discussion started by: shwang3
1 Replies

8. AIX

create widgets using perl pk module

hi I am posting this for my friend... is it possible to create widgets using perl pk module in IBM AIX 5.3? They dont have a GUI so is it possible to create the above mentioned thing in a CUI? thanks! Sathish (1 Reply)
Discussion started by: sathumenon
1 Replies

9. Shell Programming and Scripting

create an user in perl

hi friends, i want to create an new user in my home directory , only just for checking. if it is possible, please help me. thanks (1 Reply)
Discussion started by: praneshbmishra
1 Replies

10. Shell Programming and Scripting

create a directory in perl

Hi Guys!!!!!!!!!!!!!!!!!!!!! can we create or copy directories in perl without using system commands like "mkdir" and "cp" script needed urgent !!!!!!!!!!!!!!!!!!!!!!!!!!! cheers, aajan (7 Replies)
Discussion started by: aajan
7 Replies

Featured Tech Videos