05-07-2005
open FILE, ">>/some/file" || die 'Cannot open file for writing';
print FILE "\n";
close FILE;
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
May I know how to check for empty file in Perl.
Iam missing something, somewhere.
#!/usr/bin/perl
my $open_dir = '/path/';
my $file;
my $ma = "abc_.*.\.psv\$"
opendir(VAR, $open_dir) or die "Can't open $oepn_dir: $!\n";
while( defined ($file = readdir VAR) ) #read all... (1 Reply)
Discussion started by: deepakwins
1 Replies
2. UNIX for Dummies Questions & Answers
Hello,
I'm trying to create a program in perl called myfind.pl;
To use the program:
(at the command line)$ program.pl keyword filename
note: the keyword is any word or regular expression
and it should display the result just like when you 'cat' the file name but with the keyword in... (2 Replies)
Discussion started by: Horizon666
2 Replies
3. UNIX for Dummies Questions & Answers
Hi Experts,
I want to print the lines whose third field in non-empty/blank space.
i.e.
INPUT FILE/B]
dcdccghjrry0yd cont
dcdccttrk820529 cont rdekedfsSCr
dcdccttrdky2d0y cont rdekedfsSC2 ... (3 Replies)
Discussion started by: krao
3 Replies
4. Shell Programming and Scripting
Hi
Trying to do like this :
echo "$variable1\n $(cat file.txt)"
but it only adds one time. When I run this cmd again with different variable it only replaces line of variable1.
How to add constantly line into first line in file ? (3 Replies)
Discussion started by: presul
3 Replies
5. Shell Programming and Scripting
I am trying to find a way to utilise the full potential of my cpu cores and memory on my windows machine.
Now, I am quite familiar with grep, however, running a Unix based OS is not an option right now.
Unfortunately, the 32 bit grep for windows that I am running, I cannot run multiple... (1 Reply)
Discussion started by: Moloch
1 Replies
6. Shell Programming and Scripting
I got multiple of documents in which i have to extract a line coming after a ID..The scenario is
Customer ID: none
VT : 002/89
Customer ID: Yes
VT: 001/89
Customer ID: none
VT: 006/85
Customer ID: Yes
VT: 003/56
I have to extract the id which is coming after YES..The output... (7 Replies)
Discussion started by: rajkrishna89
7 Replies
7. Homework & Coursework Questions
Florida State University, Tallahassee, FL, USA, Dr. Whalley, COP4342 Unix Tools.
This program takes much of my previous assignment but adds the functionality of printing the concatenated line numbers found within the input.
Sample input from <> operator:
Hello World
This is hello
a sample... (2 Replies)
Discussion started by: D2K
2 Replies
8. Shell Programming and Scripting
Hi
The below script used to work fine. Suddenly it's uploading empty file. I am very new to perl. Please help me to find out the problem.
#!/usr/bin/perl
#script: upload.pl
use CGI qw/:standard/;
print header,
start_html('File upload');
print_form();
print_results() if... (2 Replies)
Discussion started by: Anupam_Halder
2 Replies
9. Shell Programming and Scripting
Hello,
I need a program that read a file line by line and prints out lines 1, 2 & 3 after an empty line... An example of entries in the file would be:
SRVXPAPI001 ERRO JUN24 07:28:34 1775
REASON= 0000, PROCID= #E506 #1065: TPCIPPR, INDEX= 003F
... (8 Replies)
Discussion started by: Ferocci
8 Replies
10. Shell Programming and Scripting
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
LEARN ABOUT OPENSOLARIS
fileno
ferror(3C) Standard C Library Functions ferror(3C)
NAME
ferror, feof, clearerr, fileno - stream status inquiries
SYNOPSIS
#include <stdio.h>
int ferror(FILE *stream);
int feof(FILE *stream);
void clearerr(FILE *stream);
int fileno(FILE *stream);
DESCRIPTION
The ferror() function returns a non-zero value when an error has previously occurred reading from or writing to the named stream (see
Intro(3)). It returns 0 otherwise.
The feof() function returns a non-zero value when EOF has previously been detected reading the named input stream. It returns 0 otherwise.
The clearerr() function resets the error indicator and EOF indicator to 0 on the named stream.
The fileno() function returns the integer file descriptor associated with the named stream; see open(2).
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |MT-Safe |
+-----------------------------+-----------------------------+
SEE ALSO
open(2), Intro(3), fopen(3C), stdio(3C), attributes(5), standards(5)
SunOS 5.11 17 Feb 2005 ferror(3C)