Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to determine if a file is ASCII? Post 14649 by Kelam_Magnus on Monday 4th of February 2002 01:41:27 PM
Old 02-04-2002
file command?

I don't know how well it works in a script, but I have used the "file" command to tell a file type.

# file filename
filename :ascii text

# file script.sh
script.sh :commands text

It works from the command line very well.


Here is another suggestion...

Are all of your files in one directory? If so, you can do a for loop.

for name in `ls *`
do
test -f $name
some other command
some other command
done



Last edited by Kelam_Magnus; 02-04-2002 at 02:46 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

How to determine if a File is Open?

I need to know what the best way, if possible in a perl or shell script, to determine if a file is open by a process, and if it is open for writing. While I would rather use a perl or shell script, if I have to use C, that would be ok. Thanks. (2 Replies)
Discussion started by: derrikw2
2 Replies

2. UNIX for Dummies Questions & Answers

determine the size of a file???

Hello, Can someone please tell me which command to use to determine the size of a file? When I log in to my shell account, I do this $>% ls -als total 632 8 -rw-r--r-- 1 user01 devgrp1 1558 Jul 30 23:25 .kshrc What is "1158"? Bytes? Kilobytes? I apologize if my... (8 Replies)
Discussion started by: alan
8 Replies

3. Shell Programming and Scripting

ftp - determine ascii or binary file

Hello, How to i determine via ftp commandline if files on ftp server is ascii or binary files. Like every other comon windows ftp program does it automatically. regards Thomas (5 Replies)
Discussion started by: congo
5 Replies

4. Shell Programming and Scripting

determine owner of a file

Hello, I am on a mission to determine the user of file. I have used the ls -l command but it displays permission, link, user, group, etc, but I just want to display just the name of user of a specified file. Many thanks (4 Replies)
Discussion started by: unibboy
4 Replies

5. UNIX for Advanced & Expert Users

How to determine if a file is done copying

I have a file repository in a directory where files are copied into it by ftp or samba. Some of the ftp transfers can be slow, and some of the files can be fairly large. The files are not being used for anything in this directory other than being taken out of the directory and used by the... (2 Replies)
Discussion started by: husker_ricky
2 Replies

6. Shell Programming and Scripting

convert ascii values into ascii characters

Hi gurus, I have a file in unix with ascii values. I need to convert all the ascii values in the file to ascii characters. File contains nearly 20000 records with ascii values. (10 Replies)
Discussion started by: sandeeppvk
10 Replies

7. Shell Programming and Scripting

Determine BL and RL of a file

A regular ebcdic mainframe tape usually contains header information the 1st three blocks of the tape. The header information tells the computer/user more information about what is on tape. The header info is 240 bytes in length at 80 bytes each header. The 1st block/header is volume name or... (1 Reply)
Discussion started by: Linux-wannabe
1 Replies

8. Shell Programming and Scripting

How to determine if there's a file in directory!

Hi All, I'm just wondering how can i determined if there's a file in directory and put it in a logs? dir="/home/test/" Please advise, Thanks, Use code tags, thanks. (1 Reply)
Discussion started by: nikki1200
1 Replies

9. UNIX for Dummies Questions & Answers

After Ftp'ing file to destination how to check the file if it is in correct ASCII and not corrupted

Hi Folks, While transferring file from FTP software like Filezilla the files gets corrupted. Is there any way I can check if the recently transferred file is in ASCII and not corrupted. I have tried using file -i filename command which does tell if the file character set is ASCII or binary... (6 Replies)
Discussion started by: Khan28
6 Replies

10. Shell Programming and Scripting

Convert Hex to Ascii in a Ascii file

Hi All, I have an ascii file in which few columns are having hex values which i need to convert into ascii. Kindly suggest me what command can be used in unix shell scripting? Thanks in Advance (2 Replies)
Discussion started by: HemaV
2 Replies
NG_HOLE(4)						   BSD Kernel Interfaces Manual 						NG_HOLE(4)

NAME
ng_hole -- netgraph discard node type SYNOPSIS
#include <sys/types.h> #include <netgraph/ng_hole.h> DESCRIPTION
The hole node type silently discards all data and control messages it receives. This type is used for testing and debugging. HOOKS
A ng_hole node accepts any request to connect, regardless of the hook name, as long as the name is unique. CONTROL MESSAGES
This node type supports the generic control messages, plus the following: NGM_HOLE_GET_STATS This command takes an ASCII string argument, the hook name, and returns the statistics associated with the hook as a struct ng_hole_hookstat. NGM_HOLE_CLR_STATS This command takes an ASCII string argument, the hook name, and clears the statistics associated with the hook. NGM_HOLE_GETCLR_STATS This command is identical to NGM_HOLE_GET_STATS, except that the statistics are also atomically cleared. SHUTDOWN
This node shuts down upon receipt of a NGM_SHUTDOWN control message, or when all hooks have been disconnected. SEE ALSO
netgraph(4), ng_echo(4), ngctl(8) HISTORY
The ng_hole node type was implemented in FreeBSD 4.0. AUTHORS
Julian Elischer <julian@FreeBSD.org> BSD
May 19, 2004 BSD
All times are GMT -4. The time now is 04:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy