The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Check File Exists and compare to previous day file script rbknisely Shell Programming and Scripting 3 02-07-2008 08:53 AM
how could I check whether ftp a file is successfully done or not rinku Shell Programming and Scripting 1 11-19-2007 11:34 PM
how to search string and number in one file and check in the other file knshree Shell Programming and Scripting 9 08-24-2007 01:29 AM
Have a shell script check for a file to exist before processing another file heprox Shell Programming and Scripting 3 11-14-2006 12:26 AM
Script to check for a file, check for 2hrs. then quit mmarsh UNIX for Dummies Questions & Answers 2 09-16-2005 11:46 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 06-09-2006
Registered User
 

Join Date: Jun 2006
Posts: 6
How to check if the file DOES NOT have EOF

Hi,

Please help me on this.

how to check if the file DOES NOT have EOF ??

I am using ksh for this.
Reply With Quote
Forum Sponsor
  #2  
Old 06-09-2006
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,297
Windows text files have an EOF marker - ASCII 26.

UNIX files do not have an EOF marker like that. The filesystem keeps track of the length of the file. What problem are you trying to fix?
Reply With Quote
  #3  
Old 06-09-2006
Registered User
 

Join Date: Jun 2006
Posts: 6
Actualy my problem is :
From windows machine they are ftp ing the text file.
UNIX server should have to read that file.
We are using shell script to read that file. but it is failing to read due to not able to find EOF ( file type problem)

My understanding is that While ftp ing from windows machine, they are ftping in binary mode instead of ascii mode.
so i have to write one more script to check EOF file is present or not in that ftp ed file.
Reply With Quote
  #4  
Old 06-10-2006
Registered User
 

Join Date: Jun 2006
Posts: 8
You can get the octal value of the last character of a file with...

Code:
#! /bin/sh

file=$1

size=`ls -l $file | awk '{print $5}'`
dd if=$file bs=1 skip=`expr $size - 1` count=1 2>/dev/null \
        | od -b | awk '{print $2; exit 0}'
This should work in Bourne Shell, Korn Shell, bash, or anything else that claims to be somewhat compatible with Bourne shell.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 12:23 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0