Sponsored Content
Top Forums Shell Programming and Scripting checking size of the first line in a log file Post 302111627 by kiran1112 on Thursday 22nd of March 2007 03:43:22 AM
Old 03-22-2007
checking size of the first line ina file

Hi My test.log file looks like this:
Code:
   0 190_GSTV_HUX_003QISCGSK026_error070322_115331917.log
   34 190_GSTV_HUX_003QISCGSK026_error070117_151311385.log
   12 190_GSTV_HUX_003QISCGSK026_error070117_151230001.log
   2 190_GSTV_HUX_003QISCGSK026_error070117_101010001.log
   0 190_GSTV_HUX_003QISCGSK026_error070117_0832001254.log
   0 190_GSTV_HUX_003QISCGSK026_error070115_122813125.log
   3 190_GSTV_HUX_003QISCGSK026_error070115_115331917.log
   0 190_GSTV_HUX_003QISCGSK026_error070115_114442254.log
   0 190_GSTV_HUX_003QISCGSK026_error070112_1156001509.log

Now i need to write a script which checks for the size of the first log file
ie.,in this case the size of "190_GSTV_HUX_003QISCGSK026_error070322_115331917.log"
please note that the test.log will be updated everytime i run a script and only the part remains constant is '190_GSTV_HUX_003QISCGSK026_errorXXXXXX_XXXXXXXXX.log'

is there any cmd which checks for the size of the first line in the test.log file and give the result?using which i need to write a condition...

Presently i tried this:
Code:
check=`cat /home/user/test.log | awk '{print $1}'`

but it is giving the output as :
0 34 12 2 0 0 3 0 0

if i use the condition
Code:
if [ $check = 0 ]

i m getting error as "A test command parameter is not valid."
beacause check contains 0 32 12 2 ....... Smilie

Please can some one help me in this regard???
Thanks in advance

Last edited by kiran1112; 03-23-2007 at 05:48 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Checking file size

What is the best way to check the size of a file? We have a problem with our repository growing to an unmanageable size. If it is greater than 17000000 then I'd like to send a warning to our system administrators. (2 Replies)
Discussion started by: jkuchar747
2 Replies

2. Shell Programming and Scripting

Help with checking file size

I need to check the size of a log file. If the size is anything but zero, I need to send an email. I'm using this syntax: SIZE=0 VAR1=`wc -c $DIRNAME/$FILENAME1 | awk -F" " '{print $1}' ` echo $VAR1 if then do something such as send an email fi I know that the file is indeed... (15 Replies)
Discussion started by: ssmith001
15 Replies

3. Shell Programming and Scripting

Error checking a file from previous file size

Hi, I'm currently trying to write a script that checks a log file for certain errors. Once checked it then records the filesize in another file. All this is fine, my problem is that the next time I do my error check I only want to check from previously recorded filesize to the end of file. I'm... (2 Replies)
Discussion started by: stuck1
2 Replies

4. Shell Programming and Scripting

Multiple file existence and checking file size

I want to check the files in particular directory are more that 0 Bytes i.e, Non zero byte file. The script should print a msg if all the files in that directory are empty( 0 Byte). (2 Replies)
Discussion started by: lathish
2 Replies

5. UNIX for Dummies Questions & Answers

checking directory size in the text file

Hi All, I am new to unix scripting, please help me in completing this exercise, I have a scenario as follows, 1. i have a text file(snapshot.txt) consisting of directory names, and file size separated by comma as shown below: snapshot.txt data: ... (1 Reply)
Discussion started by: G.K.K
1 Replies

6. Shell Programming and Scripting

bash: checking file size -solved

Hello I have srv RHEL5, file system UTDM (EMC DiskXtender Unix/Linux File System Manager 3.5 & EMC Centera). it all works under the scheme: have disk is formatted with a file system UTDM, drive open network - NFS, it write data, then migrate the data in the repository - EMC Centera. There are... (0 Replies)
Discussion started by: moskovets
0 Replies

7. Shell Programming and Scripting

Checking the size of a file after FTP

Hi I am doing a FTP process through which I am copying a file from my local server to Remote server. After this I want to check the size of the file Below is my program: LOCALDIR=/batch/ediprocess REMOTESERVER=test.appl.com REMOTEPATH=batch/ftpTest LOGIN=px PASSWORD=abcd ftp -n... (3 Replies)
Discussion started by: shanth_chandra
3 Replies

8. Red Hat

Checking File size

Hi Team, I am a new bie to unix and want to check a directory for a files with extension *.doc exceeding a specific file size limit,and will give me a buffer ooutput as below I used below command, find . -name \*.doc -size +3k -printf "|%p |%k KB" which resulted as, ./ABC_sw_high.doc ... (1 Reply)
Discussion started by: lisha.ahuja
1 Replies

9. UNIX for Dummies Questions & Answers

Checking Existence and file size of File

Hi, I am a SAP- ABAP programer , i have only little knowledge of Unix. My issue is i have a list of files which are in internal table. I want to create a script which consist of all these files and in one go i can check in the unix server about there existance and there file size. Can... (2 Replies)
Discussion started by: amitkumar.b2
2 Replies

10. UNIX for Dummies Questions & Answers

Checking for File Size

HI , How can I check if a file exists in a particular folder and it exists it size in greater than 0 kb. Basically I am trying to write a script which will check if a file exists and if exists then it size is greater than 0 bytes (I am not looking for empty files it should have some data... (3 Replies)
Discussion started by: wangkc
3 Replies
nislog(1M)						  System Administration Commands						nislog(1M)

NAME
nislog - display the contents of the NIS+ transaction log SYNOPSIS
/usr/sbin/nislog [-h num | -t num] [-v] [directory...] DESCRIPTION
nislog displays the contents of the NIS+ server transaction log on the standard output. This command can be used to track changes in the namespace. The /var/nis/trans.log file contains the transaction log maintained by the NIS+ server. When updates occur, they are logged to this file and then propagated to replicas as log transactions. When the log is checkpointed, updates that have been propagated to the replicas are removed. The nislog command can only be run on an NIS+ server by superuser. It displays the log entries for that server only. If directory is not specified, the entire log is searched. Otherwise, only those logs entries that correspond to the specified directories are displayed. OPTIONS
-h num Display num transactions from the ``head'' of the log. If the numeric parameter is 0, only the log header is displayed. -t num Display num transactions from the ``tail'' of the log. If the numeric parameter is 0, only the log header is displayed. -v Verbose mode. FILES
/var/nis/trans.log transaction log ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWnisu | +-----------------------------+-----------------------------+ SEE ALSO
nis+(1), rpc.nisd(1M), nisfiles(4), attributes(5) NOTES
NIS+ might not be supported in future releases of the SolarisTM Operating Environment. Tools to aid the migration from NIS+ to LDAP are available in the Solaris 9 operating environment. For more information, visit http://www.sun.com/directory/nisplus/transition.html. SunOS 5.10 12 Dec 2001 nislog(1M)
All times are GMT -4. The time now is 11:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy