Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Check if file is empty with variables, bash Post 302855475 by bjoern456 on Friday 20th of September 2013 05:50:04 AM
Old 09-20-2013
I am using the terminal in openSuse 12.3 and ls -v lists the files in a numerical way like this: (1,2,3,..,10,11,..,100).

Thank you guys, now it works! I lost the "fi" and $i was allready the name of the file as you said.Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to check for empty file in Perl?

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

How to check if a file is empty?

Hi Masters..... I have problem !!! I need to check number of records in a file and if it is zero or file is empty i need to do some task. if ; then echo "File s empty" else echo "Not empty" fi so how to check this condition. I used wc -l < filename.txt => 1 for zero records same result... (1 Reply)
Discussion started by: shreekrishnagd
1 Replies

3. Shell Programming and Scripting

How to check if two variable are empty strings at once? (bash)

I need to check if $1 or $2 are empty before continuing but I don't know if bash has any logic of the sort. This is what I'm looking for - except that "and" doesn't seem to work. if and ;then ... Thank you! :D (4 Replies)
Discussion started by: ph0enix
4 Replies

4. UNIX for Dummies Questions & Answers

to check if file is empty or not and return a non zero value

Hi All, I am new to unix worldd . I need to check a file1 if its empty or not. If its empty then return a non zero value say 99 could you pls let me know the perl script for this. (2 Replies)
Discussion started by: mavesum
2 Replies

5. Shell Programming and Scripting

check if file is empty

How do I check if a file is empty in a sh script I want to test in my shell script if the output file is empty and if it is do one thing and if it isnt empty do another? any ideas? (8 Replies)
Discussion started by: stolz
8 Replies

6. Shell Programming and Scripting

Bash-Shell: If-Clause to check if file is empty

Hello, I want to checkl whether my file has text in it or not. if ; then ... if ; then ... But none of these work Can someone help me? ---------- Post updated at 09:00 AM ---------- Previous update was at 08:55 AM ---------- The code-tags caused an displayerror,... (5 Replies)
Discussion started by: ABE2202
5 Replies

7. Shell Programming and Scripting

Need to check for empty file in C shell script

I am running a C shell script. I have an output file from a previous step and I need to run "something" in the next step to check if the file is empty. If the file is empty, then the job script should finish EOJ. If the file is not empty then the job script should abend. Please help Thanks. (4 Replies)
Discussion started by: jclanc8
4 Replies

8. Shell Programming and Scripting

Check if a text file is empty or not (using ls -s)

Hello, I want to make a script which says if a text file is empty or not. I tried two ways of making it, but I have problems with both of them. Now I think that the better way is the ls -s solution (considering that an empty text file has a 0 weight, because "cat file.txt" fails when file is... (4 Replies)
Discussion started by: Link_
4 Replies

9. Shell Programming and Scripting

Empty file check

Hi gurus , I have two files and i want to perform different action based on the condition if both or either is empty If then Do something elif then do something elif then do something else do something fi I have tried the below bt its not... (4 Replies)
Discussion started by: r_t_1601
4 Replies

10. Shell Programming and Scripting

To check whether the file is empty or not in shell script (sh)

Hi All, I need to check a file whether it exists and also whether it is empty or not. I have a code for this but it is not working as per my requirement. Can anyone pls suggest me on this. function funcFLSanityCheck { if then echo "${varFLSentFileListPath}/${varFLSentFileName}... (7 Replies)
Discussion started by: Arun1992
7 Replies
ZMORE(1)                                                      General Commands Manual                                                     ZMORE(1)

NAME
zmore - file perusal filter for crt viewing of compressed text SYNOPSIS
zmore [ name ... ] DESCRIPTION
Zmore is a filter which allows examination of compressed or plain text files one screenful at a time on a soft-copy terminal. zmore works on files compressed with compress, pack or gzip, and also on uncompressed files. If a file does not exist, zmore looks for a file of the same name with the addition of a .gz, .z or .Z suffix. Zmore normally pauses after each screenful, printing --More-- at the bottom of the screen. If the user then types a carriage return, one more line is displayed. If the user hits a space, another screenful is displayed. Other possibilities are enumerated later. Zmore looks in the file /etc/termcap to determine terminal characteristics, and to determine the default window size. On a terminal capa- ble of displaying 24 lines, the default window size is 22 lines. To use a pager other than the default more, set environment variable PAGER to the name of the desired program, such as less. Other sequences which may be typed when zmore pauses, and their effects, are as follows (i is an optional integer argument, defaulting to 1) : i<space> display i more lines, (or another screenful if no argument is given) ^D display 11 more lines (a ``scroll''). If i is given, then the scroll size is set to i. d same as ^D (control-D) iz same as typing a space except that i, if present, becomes the new window size. is skip i lines and print a screenful of lines if skip i screenfuls and print a screenful of lines q or Q Quit. = Display the current line number. i/expr search for the i-th occurrence of the regular expression expr. The user's erase and kill characters may be used to edit the regular expression. Erasing back past the first column cancels the search command. in search for the i-th occurrence of the last regular expression entered. !command invoke a shell with command. The character `!' in "command" is replaced with the previous shell command. The sequence "!" is replaced by "!". :q or :Q Quit (same as q or Q). . (dot) repeat the previous command. The commands take effect immediately, i.e., it is not necessary to type a carriage return. Up to the time when the command character itself is given, the user may hit the line kill character to cancel the numerical argument being formed. In addition, the user may hit the erase character to redisplay the --More-- message. At any time when output is being sent to the terminal, the user can hit the quit key (normally control-). Zmore will stop sending output, and will display the usual --More-- prompt. The user may then enter one of the above commands in the normal manner. Unfortunately, some output is lost when this is done, due to the fact that any characters waiting in the terminal's output queue are flushed when the quit sig- nal occurs. The terminal is set to noecho mode by this program so that the output can be continuous. What you type will thus not show on your termi- nal, except for the / and ! commands. If the standard output is not a teletype, then zmore acts just like zcat, except that a header is printed before each file if there is more than one file. FILES
/etc/termcap Terminal data base SEE ALSO
more(1), gzip(1), zdiff(1), zgrep(1), znew(1), zforce(1), gzexe(1) ZMORE(1)
All times are GMT -4. The time now is 03:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy