how to find a file with uniq extension
Hi ,
I have one file called “ab” in below path. That file contains so many no of file with dot extensions. cat ab crank.ini lion.DAT tiger.bad unix.txt linux.ini abhi.DAT P.bad del.bhabani avatar.film KNPH.film sri.txt suc.com loh.txt ama.com Please tell me how can I knw only uniq .extensions?? |
What have you thought of and tried so far?
Your question is ambiguous. Do you mean that you are given extension ".ab" and you want to know if it is unique or you want to generate a list of extensions that are unique. By "unique" do you mean unique in the current directory, current file system, computer, network ...? The first step to solving a problem is to know exactly what the problem is! |
Code:
#!/bin/bash extension3 will have the unique extensions,i think |
Code:
$ awk -F"." '!a[$NF]++{print $NF}' file |
Can you explain the code??
|
Code:
$ awk -F"." 'a[$NF]++{print $NF,a[$NF]}' file Code:
$ awk -F"." '!a[$NF]++{print $NF,a[$NF]}' file |
All times are GMT -5. The time now is 03:16 AM. |