07-18-2014
one case could be
If you write some content and delete that, the file has a size 1
do a wc on the file wc $file
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Dear All
I want to do following task. Kindly suggest.
In my script every hour one file is genarated. say xyz.txt.
Now if this file contain some data then i want to do task A and if file is blank then i want to do nothing.
Kindly help me to do this.
regards
jaydeep (5 Replies)
Discussion started by: jaydeep_sadaria
5 Replies
2. UNIX for Dummies Questions & Answers
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. UNIX for Dummies Questions & Answers
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
4. Shell Programming and Scripting
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
5. Shell Programming and Scripting
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
6. Shell Programming and Scripting
Hi All,
I have a file.txt which seems like having three lines.
wc -l file.txt
3 file.txt
In fact, once it is open in text editor, this file has four lines where the last line is empty. how can i delete this last empty line of the file.txt? I tried the codes below so far but they... (6 Replies)
Discussion started by: senayasma
6 Replies
7. Shell Programming and Scripting
TT0000013101257
|
JCJMMUJMMUB018 ... (0 Replies)
Discussion started by: sususa
0 Replies
8. Shell Programming and Scripting
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
9. Shell Programming and Scripting
Hi All
Need Help
I have a file with the below format (ABC.TXT) :
®¿¿ABCDHEJJSJJ|XCBJSKK01|M|7348974982790
HDFLJDKJSKJ|KJALKSD02|M|7378439274898
KJHSAJKHHJJ|LJDSAJKK03|F|9898982039999
(cont......)
I need to write a script where it will check for : blank lines (between rows,before... (6 Replies)
Discussion started by: chatwithsaurav
6 Replies
10. Shell Programming and Scripting
Hello,
I have a dictionary of over 400,000 words with the following structure
source=target
The database contains single words as well as phrases. To train the data, I need only mappings with out a space i.e. where both source and target do not have any space in between.
I use Ultraedit as... (4 Replies)
Discussion started by: gimley
4 Replies
DBM(3X) DBM(3X)
NAME
dbminit, fetch, store, delete, firstkey, nextkey - data base subroutines
SYNOPSIS
#include <dbm.h>
typedef struct {
char *dptr;
int dsize;
} datum;
dbminit(file)
char *file;
datum fetch(key)
datum key;
store(key, content)
datum key, content;
delete(key)
datum key;
datum firstkey()
datum nextkey(key)
datum key;
DESCRIPTION
Note: the dbm library has been superceded by ndbm(3), and is now implemented using ndbm. These functions maintain key/content pairs in a
data base. The functions will handle very large (a billion blocks) databases and will access a keyed item in one or two file system
accesses. The functions are obtained with the loader option -ldbm.
Keys and contents are described by the datum typedef. A datum specifies a string of dsize bytes pointed to by dptr. Arbitrary binary
data, as well as normal ASCII strings, are allowed. The data base is stored in two files. One file is a directory containing a bit map
and has `.dir' as its suffix. The second file contains all data and has `.pag' as its suffix.
Before a database can be accessed, it must be opened by dbminit. At the time of this call, the files file.dir and file.pag must exist.
(An empty database is created by creating zero-length `.dir' and `.pag' files.)
Once open, the data stored under a key is accessed by fetch and data is placed under a key by store. A key (and its associated contents)
is deleted by delete. A linear pass through all keys in a database may be made, in an (apparently) random order, by use of firstkey and
nextkey. Firstkey will return the first key in the database. With any key nextkey will return the next key in the database. This code
will traverse the data base:
for (key = firstkey(); key.dptr != NULL; key = nextkey(key))
DIAGNOSTICS
All functions that return an int indicate errors with negative values. A zero return indicates ok. Routines that return a datum indicate
errors with a null(0) dptr.
SEE ALSO
ndbm(3)
BUGS
The `.pag' file will contain holes so that its apparent size is about four times its actual content. Older UNIX systems may create real
file blocks for these holes when touched. These files cannot be copied by normal means (cp, cat, tp, tar, ar) without filling in the
holes.
Dptr pointers returned by these subroutines point into static storage that is changed by subsequent calls.
The sum of the sizes of a key/content pair must not exceed the internal block size (currently 1024 bytes). Moreover all key/content pairs
that hash together must fit on a single block. Store will return an error in the event that a disk block fills with inseparable data.
Delete does not physically reclaim file space, although it does make it available for reuse.
The order of keys presented by firstkey and nextkey depends on a hashing function, not on anything interesting.
4th Berkeley Distribution May 12, 1986 DBM(3X)