Link to home
Start Free TrialLog in
Avatar of wademi
wademi

asked on

C Shell script to get patterns n a filename

How would I get the following numbers from  the below file names using a C Shell script?

314
4487

Files:
bad_314k_256x144_x264_250_quicktime_64.mp4
agel_4487k_512x288_x264_384_quicktime_64

Can someone help me with the syntax to get this?
I am not sure iif C Shell has regular expression
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

echo "bad_314k_256x144_x264_250_quicktime_64.mp4" | awk -F"_|k" '{print $2}'
ASKER CERTIFIED SOLUTION
Avatar of Gerwin Jansen
Gerwin Jansen
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Tintin
Tintin

Do you have to use csh?  csh is the worst shell for scripting.
Why are you giving me all points? Is woolmilkporc's awk solution not working? If it is then please post a comment why you made this choice. Thanks.