Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^3: selcting a specific file

by andyford (Curate)
on Oct 22, 2007 at 22:24 UTC ( #646594=note: print w/ replies, xml ) Need Help??


in reply to Re^2: selcting a specific file
in thread selcting a specific file

That's my point. -z is looking for a zero byte file, but 'no content' could be a bunch of tabs and spaces.

[forda@hqnagtl1 ~]$ touch emptytest1 [forda@hqnagtl1 ~]$ touch emptytest2 [forda@hqnagtl1 ~]$ ls -l emptytest* -rw-rw-r-- 1 forda forda 0 Oct 22 17:19 emptytest1 -rw-rw-r-- 1 forda forda 0 Oct 22 17:19 emptytest2 [forda@hqnagtl1 ~]$ echo ' ' >> emptytest2 [forda@hqnagtl1 ~]$ ls -l emptytest* -rw-rw-r-- 1 forda forda 0 Oct 22 17:19 emptytest1 -rw-rw-r-- 1 forda forda 15 Oct 22 17:20 emptytest2
I put some spaces into a formerly empty file and now it has a size of 15.

non-Perl: Andy Ford


Comment on Re^3: selcting a specific file
Download Code
Replies are listed 'Best First'.
Re^4: selcting a specific file
by Anonymous Monk on Oct 22, 2007 at 23:33 UTC
    wht command did you select for getting such an output???

      Sorry, I should have mentioned that my example is on Unix. The point is that for -z to flag a file as empty, it must have nothing in it. No spaces, no tabs, no nothing.

      non-Perl: Andy Ford

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://646594]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (8)
As of 2015-07-08 04:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (94 votes), past polls