Sponsored Content
Full Discussion: File format check
Top Forums UNIX for Dummies Questions & Answers File format check Post 302247877 by jim mcnamara on Thursday 16th of October 2008 02:26:01 PM
Old 10-16-2008
If there is a possibility that some records are bad, you need to read the whole thing. If you are just identifying the format, you can read a few lines.
whole file scan
Code:
awk -F'|'  'BEGIN{ max=0} 
             { if (NF > max ) {max =NF} 
             END{ print "max fileds found=", max}' inputfile

partial:
Code:
head inputfile | awk -F'|'  'BEGIN{ max=0} 
             { if (NF > max ) {max =NF} 
             END{ print "max fileds found=", max}'

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Check whether a given file is in ASCII format and data is tab-delimited

Hi All, Please help me out with a script which checks whether a given file say abc.txt is in ASCII format and data is tab-delimited. If the condition doesn't satisfy then it should generate error code "100" for file not in ASCII format and "105" if it is not in tab-delimited format. If the... (9 Replies)
Discussion started by: Mandab
9 Replies

2. Shell Programming and Scripting

Check the format of Date

Hi, I have a date field in my input file. I just want to check if its in the format "DD-MM-YYYY". Is there any command which can achieve this? Thanks and Regards, Abhishek (2 Replies)
Discussion started by: AAA
2 Replies

3. Shell Programming and Scripting

How to check for file name of specific format using find?

I have to find the specific formatted file is present in the received list in the directory, for which I have written: file_list=`ls -lrt /tmp/vinay/act/files |grep "$cdate"| awk '{print $9}'` while read fileStr do find $file_list $fileStr > /dev/null status=`echo $?` if ; then ... (3 Replies)
Discussion started by: IND123
3 Replies

4. Shell Programming and Scripting

How to check file name format using shell script?

Hi, I am writting a script, which accepts input file as parameter. Input file name is aa_bb_cc_dd_ee.<ext> I need to check that input file name should be of 5 fileds. Please help me out. :confused: (7 Replies)
Discussion started by: Poonamol
7 Replies

5. Shell Programming and Scripting

Need to check date format yyyymm

My source file having one date column. The formate of the date column is yyyymm. I need to validate whether all the rows are in same format in the given file. If it is not I have captured that records in a separate file. I am very new to Unix. I don't how to achieve this. Plz help me to achieve... (2 Replies)
Discussion started by: suresh01_apk
2 Replies

6. Shell Programming and Scripting

finding date numeral from file and check the validity of date format

hi there I have file names in different format as below triss_20111117_fxcb.csv triss_fxcb_20111117.csv xpnl_hypo_reu_miplvdone_11172011.csv xpnl_hypo_reu_miplvdone_11-17-2011.csv xpnl_hypo_reu_miplvdone_20111117.csv xpnl_hypo_reu_miplvdone_20111117xfb.csv... (10 Replies)
Discussion started by: manas_ranjan
10 Replies

7. Shell Programming and Scripting

Script to check dos format in a file

Hi All, I am trying to check if the file is in dos format using simple grep command but the problem is lines inside the file with have special characters in between and in some lines end of the line will have the '^M' character. I tried the below command in simple line(without special... (7 Replies)
Discussion started by: Optimus81
7 Replies

8. Shell Programming and Scripting

How to check user entered correct file format or not?

Hi Experts, path=/db/files/ format=$1 User can enter any file format.compare the user file format with actual file format existed in the directory /db/files. User enter all characters as "A" apart from date format. example1: user will be entering the file format AAA_AA_YYYYMMDD.AAA Actual... (6 Replies)
Discussion started by: nalu
6 Replies

9. Shell Programming and Scripting

Telephone Format and Check

How can I script to check telephone number entered by user in a uniz script: print -n "Enter telephone number to check ? " ; read telno How do I script to : 1) Check if entered without dashes or with dashes 2) If without dashes how can I check: if telno is only 10... (2 Replies)
Discussion started by: mrn6430
2 Replies

10. UNIX for Beginners Questions & Answers

Check if file is EBCDIC or ASCII format

So, i have this requirement where i need to check the file format, whether it's EBCDIC or ASCII, and based on format retrieve the information from that file: my file is: file1.txt-->this ebcdic file file2.txt-->ascii file i tried below code: file=file1.txt type="`file $file`" i get... (7 Replies)
Discussion started by: gnnsprapa
7 Replies
cdsuf(1)						      General Commands Manual							  cdsuf(1)

NAME
cdsuf - read the System Use Fields from a System Use Area SYNOPSIS
cdsuf [-s number] [-b] file OPTIONS
The following options are available: Specifies the File Section for the System Use Area to be read. The numbering starts with one. If this option is omitted the last File Section of that file is assumed. Copies all of the System Use Fields of the System Use Area from the CD- ROM to standard output in binary format. The name of any file or directory within the CD-ROM file hierarchy. DESCRIPTION
This command is used to access the System Use Fields of the System Use Area associated with a File Section of a file or directory on a Rock Ridge formatted CD-ROM and to list its contents on standard output, following any Continuation Fields that may be present. The output is formatted in the form of a table that contains an entry for each System Use Field in the System Use Area as recorded on the CD-ROM. Each table entry has the fields Signature, Length, Version, and Data as specified in the System Use Sharing Protocol. If the -b option is used, the contents of the full System Use Area are written to standard output in binary format as it is recorded on the CD-ROM. RESTRICTIONS
The user must have read permission for file to execute the command successfully. EXIT STATUS
The following exit values are returned: Successful completion. File not found, file is not a file or directory within a CD-ROM file hier- archy, or access denied. File Section indicated by -s does not exist. File Section indicated by -s has no System Use Area. SEE ALSO
cd_suf(3) cdsuf(1)
All times are GMT -4. The time now is 12:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy