AIX 5.3 / KSH
I have a Java application which creates a log file a.log. I have a KSH script which does the following action
cp a.log /directory2/b.log
> a.log
After this the file size goes to 0 as per "ls -l"
Then next time when the application writes into this file, the file size... (4 Replies)
Hi All,
I am checking for a empty input file to do some further action , but I am getting exit status 0 in both the cases , for empty and non empty file both.
The value of $? is coming 0 in if part also and else part too.
#!/bin/ksh
if ]; then
echo "data"
# exit 0
echo "$?"
else... (4 Replies)
Hi everyone.
I am a newbie to Linux stuff. I have this kind of problem which couldn't solve alone. I have a text file with records separated by empty lines like this:
ID: 20
Name: X
Age: 19
ID: 21
Name: Z
ID: 22
Email: xxx@yahoo.com
Name: Y
Age: 19
I want to grep records that... (4 Replies)
Hi Expert,
Kindly request for your expertise in this matter.
I have below output:
12.125.124.173,xx1.common.com
12.125.124.174,xx2.common.com
12.125.124.175,xx3.common.com
12.125.124.176,
12.125.124.177,
12.125.124.178,
12.125.124.179,xx4.common.com
12.125.124.180,xx5.common.com... (8 Replies)
Hi there,
I'm just starting out with shell scripting and I'm trying to make a test where the script will basically run yum check-update to find out if the server has any available and if it does it e-mails me but if not it will just stop there.
I have it working if there are actually... (7 Replies)
Suppose i have the following data :
cat file.txt
12431,123334,55353,546646,14342234,4646,35234
123123,3535,123434,132535,1234134,13535,123534
123213,545465,23434,45646,2342345,4656,31243
2355425,2134324,53425,342,35235,23434,234535
3423424,234234,65465,,2344,35436,234524,234... (7 Replies)
Hi,
I'm writing a shell script and trying to grep a variable value, it works fine as long as there is a value in /tmp/list.out which is captured in $DSK but sometimes the file tends to be empty and that is where I'm having an issue while using grep which returns nothing. I know I can use something... (15 Replies)
Given a csv file with 40 columns with name, address, hometown etc.
I use a bash command in 1 line which:
1. gets the address column and pipes that to
2. grep the first digit and everything that follows
Command:
awk -F ";" '{print $19}' /Users/jb/Desktop/ReorderTempTotal.csv | grep -o "\d.*"... (7 Replies)
The below awk improved bu @MadeInGermany, works great as long as the input file has data in it in the below format:
input
chrX 25031028 25031925 chrX:25031028-25031925 ARX 631 18
chrX 25031028 25031925 chrX:25031028-25031925 ARX 632 14... (3 Replies)
Discussion started by: cmccabe
3 Replies
LEARN ABOUT DEBIAN
file::queue
File::Queue(3pm) User Contributed Perl Documentation File::Queue(3pm)NAME
File::Queue - Persistent FIFO queue implemented in pure perl!
SYNOPSIS
use strict; # always!
use File::Queue;
my $q = new File::Queue (File => '/var/spool/yourprog/queue');
$q->enq('some flat text1');
$q->enq('some flat text2');
$q->enq('some flat text3');
# Get up to first 10 elements
my $contents = $q->peek(10);
my $elem1 = $q->deq();
my $elem2 = $q->deq();
# empty the queue
$q->reset();
DESCRIPTION
This module allows for the creation of persistent FIFO queue objects.
File::Queue only handles scalars as queue elements. If you want to work with references, serialize them first!
The module was written with speed in mind, and it is very fast, but it should be used with care. Please refer to the CAVEATS section.
Interface
File::Queue implements a OO interface. The object methods and parameters are described below.
Methods
File::Queue supports all of the queue-related functions a developer should expect.
o new()
Instantiates your File::Queue object. Parameters are described in the next sub-section.
o enq()
Enqueues a string element to the queue.
o deq()
Dequeues a string element from the queue, and returns the element. If the queue is empty, nothing is returned.
o peek(n)
Returns an arrayref containing the next n elements in the queue. If the queue size is less than n, all elements are returned. If the
queue is empty, an empty arrayref is returned.
o reset()
Emptys the queue.
o close()
Closes the filehandles belonging to the queue object ('.dat' and '.idx').
o delete()
Deletes the files belonging to the queue object ('.dat' and '.idx').
Parameters
There are a number of parameters that can be passed when constructing your File::Queue objects. Parameters are case-insensitive.
o File (required)
File::Queue creates two files using this parameter as the base. In the case of the example in the SYNOPSIS, the two files are
'/var/spool/yourprog/queue.dat' and '/var/spool/yourprog.idx'.
The '.dat' file holds all of the data, the '.idx' file holds the byte index (pointer) of the starting point of the first element in the
queue.
o Mode (optional)
The file bit mode to be shared by both the '.dat' and '.idx' files. Defaults to '0600'.
o Seperator (optional)
The character or byte sequence that is used to seperate queue elements in the '.dat' file. It should be something you can guarantee
will NEVER appear in your queue data. Defaults to the newline character.
o BlockSize (optional)
This is the size of the byte chunks that are pulled at each iteration when checking for the end of a queued element. Defaults to 64,
which will be fine for most cases, but can be tweaked or tuned for your specific case to squeeze out a few extra nanoseconds.
CAVEATS
This module should never be used in situations where the queue is not expected to become empty.
The '.dat' file is not truncated (emptied) until the queue is empty.
Even the data you've already dequeued remains in the '.dat' file until the queue is empty.
If you keep enqueueing elements and never FULLY dequeue everything, eventually your disk will fill up!
SEE ALSO
Tie::File
AUTHOR
Jason Lavold <jlavold [ at ] gmail.com>
perl v5.10.0 2008-12-22 File::Queue(3pm)