C Shell script to get patterns n a filename

Posted on 2011-10-31
Last Modified: 2012-05-12
How would I get the following numbers from  the below file names using a C Shell script?



Can someone help me with the syntax to get this?
I am not sure iif C Shell has regular expression
Question by:wademi
    LVL 68

    Expert Comment

    echo "bad_314k_256x144_x264_250_quicktime_64.mp4" | awk -F"_|k" '{print $2}'
    LVL 37

    Accepted Solution

    echo "bad_314k_256x144_x264_250_quicktime_64.mp4" | cut -d"_" -f2 | cut -d"k" -f1

    Open in new window

    LVL 48

    Expert Comment

    Do you have to use csh?  csh is the worst shell for scripting.
    LVL 37

    Expert Comment

    by:Gerwin Jansen
    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.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
    Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
    Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
    This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now