Sponsored Content
Top Forums Shell Programming and Scripting how to read the contents of a file using PERL Post 302354036 by meva on Thursday 17th of September 2009 12:18:56 AM
Old 09-17-2009
Java how to read the contents of a file using PERL

Hi

My requirement is to read the contents of a fixed length file and validate the same.

But am not able to read the contents of the file and when i tried it to print i get <blank> as an output...

I used the below satatements for printing the contents

open(INPFILE,"/data/sample.txt");
while($line = <INPFILE>) {
print ": $_";
}

can anyone help me on how to read the file contents using perl...
 

10 More Discussions You Might Find Interesting

1. Programming

How to read and write directory or file contents in c++ ?

Dear Friends, I m beginner unix programmer. I want to know, how to read and write directory or file contents in c++ ? (3 Replies)
Discussion started by: namrata5
3 Replies

2. Shell Programming and Scripting

Read File and use contents to rename another

Hello guys, thank God that I found this forum. I hope that someone can help me because I don't have any idea on how to start it. I know that for some of you this is a very simple task but I'm not as advance on shell scripting like many people out there. I got this file with a permanent... (10 Replies)
Discussion started by: Shark Tek
10 Replies

3. Shell Programming and Scripting

Read contents of the file and print

AT ---------- 0 Elapsed: 00:00:00.02 SO ---------- 0 Elapsed: 00:00:00.01 SE ---------- 0 Elapsed: 00:00:00.01 CR ---------- (4 Replies)
Discussion started by: sandy1028
4 Replies

4. Shell Programming and Scripting

Read contents from a file

Hi Friends, I am new to this forum. Just struck up with a logic. I have a csv file seperated by ":" (colons). This csv file contains hostname and groups as follows: HOSTNAME:VT Group SGSGCT2AVPX001:Team1 SGSGCT2AVPX003:Team2 SGSGCT2AVPX005:Team2 PHMNCTTAVPX001:Team3 I want to... (2 Replies)
Discussion started by: dbashyam
2 Replies

5. Shell Programming and Scripting

How to read contents of a file into variable :(

My file is in this format : username : student information : default shell : student ID Eg : joeb:Joe Bennett:/bin/csh:1234 jerryd:Jerry Daniels:/bin/csh:2345 deaverm: Deaver Michelle:/bin/bash:4356 joseyg:Josey Guerra:/bin/bash:8767 michaelh:Michael Hall:/bin/ksh:1547 I have to... (1 Reply)
Discussion started by: dude_me5
1 Replies

6. Homework & Coursework Questions

How to read contents of a file into variable :(

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I have to read the contents of each field of a file creating user accounts. The file will be of format : ... (6 Replies)
Discussion started by: dude_me5
6 Replies

7. Shell Programming and Scripting

how to read contents of file?

I have made a script something like this. I want it to read the contents of either file or directory but 'cat' and 'ls' is not working. Can anyone help me? I am a newbie in scripting so dont know much about it. I also dont know how can i put my code separatly on this forum #!/bin/bash echo... (9 Replies)
Discussion started by: nishrestha
9 Replies

8. Programming

read() contents from a file

Hi, I'm trying to implement a C program on ubuntu which reads the contents of a file that is passed in as an argument and then displays it to the screen. So far I've cobbled together this from bits online but most of it is probably wrong as its all copied and pasted... #include <stdio.h>... (2 Replies)
Discussion started by: cylus99
2 Replies

9. Shell Programming and Scripting

read contents of a file using AWK

Hi, I am kind of new at awk programming, so any help would be great ! I am trying to read a date from a file into a variable and a count into another variable and display both these variables. The file looks like the attached file... I tried this but it doesn't work ... ... (6 Replies)
Discussion started by: RDR
6 Replies

10. Shell Programming and Scripting

Replace partial contents of file with contents read from other file

Hi, I am facing issue while reading data from a file in UNIX. my requirement is to compare two files and for the text pattern matching in the 1st file, replace the contents in second file by the contents of first file from start to the end and write the contents to thrid file. i am able to... (2 Replies)
Discussion started by: seeki
2 Replies
wmiir(1)						      General Commands Manual							  wmiir(1)

NAME
wmiir - The wmii 9P filesystem client SYNOPSIS
wmiir [-a <address>] {create | ls [-dlp] | read | remove | write} <file> wmiir [-a <address>] xwrite <file> <data> ... wmiir -v DESCRIPTION
wmiir is a simple 9P filesystem client which ships with wmii, and connects to its virtual filesystem by default. wmiir is most often used to query and issue commands to wmii, both from the command line and from its sh-based configuration scripts. ARGUMENTS
-a The address at which to connect to wmii. COMMANDS
create <file> Creates a new file or directory in the filesystem. Permissions and file type are inferred by wmii. The contents of the standard input are written to the new file. ls [-dlp] <path> Lists the contents of <path>. Flags: -d Don't list the contents of directories. -l Long output. For each file, list its permissions, owner, group, size (bytes), mtime, and name. -p Print the full path to each file. read <file> Reads the entire contents of a file from the filesystem. Blocks until interrupted or EOF is received. Synonyms: cat remove <path> Removes <path> from the filesystem. Synonyms: rm write <file> Writes the contents of the standard input to <file>. xwrite <file> <data> ... Writes each argument after <file> to the latter. ENVIRONMENT
$WMII_ADDRESS The address at which to connect to wmii. $NAMESPACE The namespace directory to use if no address is provided. SEE ALSO
wmii(1), libixp[2] [1] http://www.suckless.org/wiki/wmii/tips/9p_tips [2] http://libs.suckless.org/libixp wmii-3.9.2 Oct, 2009 wmiir(1)
All times are GMT -4. The time now is 02:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy