Sponsored Content
Top Forums Shell Programming and Scripting How to use awk to classify file extension from input ls -l Post 302395361 by retsuseiba on Monday 15th of February 2010 09:22:47 PM
Old 02-15-2010
How to use awk to classify file extension from input ls -l

i try to do this for a long time
input is command ls -l
and output is:

Code:
Number of files : xx 
Number of file type – awk : 5        total size: 2345 bytes  // file ex type .awk
Number of file type – dat : 10        total size:  233 bytes  // file ex type .dat
...
Number of unknown file type : 20    total size: 9879 bytes // no file type

i try to write awk script because this is my awk's practice
thank for any comment
ps. sorry for my poor english

Last edited by Scott; 02-23-2010 at 07:46 PM.. Reason: Code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

stripp extension from file and use as input....

trying to evaluate some files.... synopsis": list all files with .xml ext.....remove the .xml ext... then use the file without the .xml ext and pass through two style sheets...one returning the filename with .xml ext and the other returning filename with .OK got errors........ (4 Replies)
Discussion started by: jazz21
4 Replies

2. Shell Programming and Scripting

AWK Script to convert input file(s) to output file

Hi All, I am hoping someone can help me with some scripting I need to complete using AWK. I'm trying to process multiple fixed files to generate one concatenated fixed file in a standard format. The Input file is:- aaaa bbbbb ccccc 1 xxxx aaa bbb aaaa bbbbb ccccc 2 abcd aaa CCC... (9 Replies)
Discussion started by: jason_v_brown
9 Replies

3. Shell Programming and Scripting

awk and regex to find out file extension

From following data, I want to only publish those lines in which column 6 has the value with extension .dat. col1,col2,col3,col4,col5,col6.txt,col7,col8 col1,col2,col3,col4,col5,col6.date,col7,col8 col1,col2,col3,col4,col5,col6.jpg,col7,col8 col1,col2,col3,col4.dat,col5,col6.dat,col7,col8... (3 Replies)
Discussion started by: fahdmirza
3 Replies

4. Shell Programming and Scripting

Awk command without input file

i have a requirement to compare two time stamps in IF condition and return true whenever the second timestamp is greater than first, i will also be checking, if the timestamp in HHMMSS format( 6 digit time stamp ).Im able to achieve it using awk, however i dont want to give any input file to awk... (3 Replies)
Discussion started by: saikiran_1984
3 Replies

5. Shell Programming and Scripting

awk- reading input file twice

Hello, I've been trying to come up with a solution for the following problem; I have an input file with two columns and I want to print as an output the first column without any changes but for the second column, I want to divide it by its last value. Example input: 1 9 2 10 3 11 4 12 5... (14 Replies)
Discussion started by: acsg
14 Replies

6. Shell Programming and Scripting

AWK to classify a file into several ones ..

Good Day All, I need to make a script that will do the following : 1- read a .csv file line by line, check the 3 field of each file print the whole line if this field matches the condition (note : FS = ",") 2-from the basic file, the script should genrate 3 new files based on the step #1... (6 Replies)
Discussion started by: engkemo2002
6 Replies

7. UNIX for Dummies Questions & Answers

awk - Rename output file, after processing, same as input file

I have one input file ABC.txt and one output DEF.txt. After the ABC is processed and created output, I want to rename ABC.txt to ABC.orig and DEF to ABC.txt. Currently when I am doing this, it does not process the input file as it cannot read and write to the same file. How can I achieve this? ... (12 Replies)
Discussion started by: High-T
12 Replies

8. Shell Programming and Scripting

awk to reformat output if input file is empty, but not if file has data in it

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

9. Shell Programming and Scripting

Classify lines in file using perl

The below perl executes and does classify each of the 3 lines in file.txt. Lines 2 and 3 are correct as they fit the criteria for Rule 2. The problem is that line one should be classified VUS as it does not meet the criteria for Rule 1, so Rule 3 is used. However, currently Rule 2 is changing the... (27 Replies)
Discussion started by: cmccabe
27 Replies

10. Shell Programming and Scripting

Use while loop to read file and use ${file} for both filename input into awk and as string to print

I have files named with different prefixes. From each I want to extract the first line containing a specific string, and then print that line along with the prefix. I've tried to do this with a while loop, but instead of printing the prefix I print the first line of the file twice. Files:... (3 Replies)
Discussion started by: pathunkathunk
3 Replies
NEWFS_EXFAT(8)						    BSD System Manager's Manual 					    NEWFS_EXFAT(8)

NAME
newfs_exfat -- construct a new ExFAT file system SYNOPSIS
newfs_exfat [-N] [-R] [-I volume-serial-number] [-S bytes-per-sector] [-a sectors-per-FAT] [-b bytes-per-cluster] [-c sectors-per-cluster] [-n number-of-FATs] [-s total-sectors] [-v volume-name] special DESCRIPTION
The newfs_exfat utility creates an ExFAT file system on device special. If the -R option is not given, and the device is already formatted as ExFAT, it will preserve the partition offset, bytes per cluster, FAT offset and size, number of FATs, offset to start of clusters, number of clusters, volume serial number, and volume name (label). If a volume name was specified via the -v option, that name is used instead of the volume's previous name. The options are as follow: -N Don't create a file system: just print out parameters. -R Do not check whether the device is currently formatted as ExFAT. Always derive the partition offset, bytes per cluster, FAT offset and size, and offset to start of clusters based on the device type and size. -I volume-serial-number Volume ID, a 32-bit integer. -S bytes-per-sector Number of bytes per sector. Acceptable values are powers of 2 in the range 512 through 4096. -a sectors-per-FAT Number of sectors per FAT. -b bytes-per-cluster File system block size (bytes per cluster). Acceptable values are powers of 2 in the range 512 through 33554432. -c sectors-per-cluster Sectors per cluster. Acceptable values are powers of 2 in the range 1 through 65536. -n number-of-FATs Number of FATs. Acceptable values are 1 or 2. The default is 1. Using any value other than 1 is discouraged, and may be incompati- ble with other devices. -s total-sectors The total number of sectors in the device. -v volume-name Volume name (label). The name will be converted to UTF-16, and must be no longer than 11 UTF-16 characters. ASCII control charac- ters and some punctuation characters are not allowed (similar to DOS 8.3-style names). NOTE: The volume name may be an empty (zero- length) string. EXAMPLES
newfs_exfat /dev/disk0s1 Create a file system, using default parameters (or existing ExFAT layout), on /dev/rdisk0s1. newfs_exfat -v Hello disk2s1 Create a file system with the name "Hello" on /dev/rdisk2s1. SEE ALSO
mount_exfat(8), fsck_exfat(8) DIAGNOSTICS
Exit status is 0 on success and 1 on error. HISTORY
The newfs_exfat command appeared in Mac OS X 10.6.3. Darwin January 19, 2010 Darwin
All times are GMT -4. The time now is 04:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy