jefferson1 Posted April 24, 2020 Report Posted April 24, 2020 Another linux question for you bro @kumar4world oka folder lo files unnai mp4 some files have two digit numeric number and .mp4 examlple-> 24.mp4 Some files ki string.mp4 undi , example -> xyz.mp4 i need count of files with numeric and i need count of files with string grep -irl *.mp4" | wc-l chesthe whole count vasthundi.... i am unable to distinguish Quote
kumar4world Posted April 24, 2020 Report Posted April 24, 2020 28 minutes ago, jefferson1 said: Another linux question for you bro @kumar4world oka folder lo files unnai mp4 some files have two digit numeric number and .mp4 examlple-> 24.mp4 Some files ki string.mp4 undi , example -> xyz.mp4 i need count of files with numeric and i need count of files with string grep -irl *.mp4" | wc-l chesthe whole count vasthundi.... i am unable to distinguish $ ls | grep mp4 0abc.mp4 2def.mp4 abc.mp4 def.mp4 $ ls | grep mp4 | awk -F '.' '{print $1}' | grep [0-9] 0abc 2def $ ls | grep mp4 | awk -F '.' '{print $1}' | grep -v [0-9] abc def finally: ls | grep mp4 | awk -F '.' '{print $1}' | grep [0-9] | wc -l ls | grep mp4 | awk -F '.' '{print $1}' | grep -v [0-9] | wc -l 1 Quote
jefferson1 Posted April 24, 2020 Author Report Posted April 24, 2020 49 minutes ago, kumar4world said: $ ls | grep mp4 0abc.mp4 2def.mp4 abc.mp4 def.mp4 $ ls | grep mp4 | awk -F '.' '{print $1}' | grep [0-9] 0abc 2def $ ls | grep mp4 | awk -F '.' '{print $1}' | grep -v [0-9] abc def finally: ls | grep mp4 | awk -F '.' '{print $1}' | grep [0-9] | wc -l ls | grep mp4 | awk -F '.' '{print $1}' | grep -v [0-9] | wc -l thanks for the help... oka small correction lets say we have a folder structure like month/day/hour wise ex: 04/23/00 04/23/01 04/23/02.... 04/23/23 04/23... which is yesterday date can we run the same thing on this folder(04/23) to get the count from the sub directories Quote
kumar4world Posted April 24, 2020 Report Posted April 24, 2020 19 minutes ago, jefferson1 said: thanks for the help... oka small correction lets say we have a folder structure like month/day/hour wise ex: 04/23/00 04/23/01 04/23/02.... 04/23/23 04/23... which is yesterday date can we run the same thing on this folder(04/23) to get the count from the sub directories find 04/23 -name "*.mp4" | awk -F"/" '{print $NF}' | awk -F '.' '{print $1}' | grep [0-9] find 04/23 -name "*.mp4" | awk -F"/" '{print $NF}' | awk -F '.' '{print $1}' | grep -v [0-9] Quote
jefferson1 Posted April 24, 2020 Author Report Posted April 24, 2020 26 minutes ago, kumar4world said: find 04/23 -name "*.mp4" | awk -F"/" '{print $NF}' | awk -F '.' '{print $1}' | grep [0-9] find 04/23 -name "*.mp4" | awk -F"/" '{print $NF}' | awk -F '.' '{print $1}' | grep -v [0-9] unfortunately this is not returning results bro as of now, the folder as .mp4 9 files numeric.mp4 are 5 files text.mp4 are 4 files ls | grep mp4 | awk -F '.' '{print $1}' | grep [0-9] | wc -l ( this is giving me whole total of mp4)...resulst 9 ls | grep mp4 | awk -F '.' '{print $1}' | grep -v [0-9] | wc -l ( this is giving 0 value) Quote
kumar4world Posted April 24, 2020 Report Posted April 24, 2020 46 minutes ago, jefferson1 said: unfortunately this is not returning results bro as of now, the folder as .mp4 9 files numeric.mp4 are 5 files text.mp4 are 4 files ls | grep mp4 | awk -F '.' '{print $1}' | grep [0-9] | wc -l ( this is giving me whole total of mp4)...resulst 9 ls | grep mp4 | awk -F '.' '{print $1}' | grep -v [0-9] | wc -l ( this is giving 0 value) find 04/23 -name "*.mp4" | awk -F"/" '{print $NF}' | awk -F '.' '{print $1}' | grep [0-9] find 04/23 -name "*.mp4" | awk -F"/" '{print $NF}' | awk -F '.' '{print $1}' | grep -v [0-9] These two should work, please direct message me your directory structure and we can solve it Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.